From 7242e6a9b6f692b1d7d3f26bfe4a34356ca743a6 Mon Sep 17 00:00:00 2001 From: shugo Date: Tue, 29 Nov 2016 02:47:11 +0000 Subject: net/ftp: add a new option ssl_handshake_timeout to Net::FTP.new. The TLS handshake timeout can be specified independently, because the TLS handshake doesn't start just after the underlying connection is established, but after the AUTH command is completed. It's also useful for testing purposes. However, if ssl_handshake_timeout is not specified, open_timeout is used instead for convenience. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/net/ftp/test_ftp.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'test/net') diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb index d40e2d8283..fb9852e63d 100644 --- a/test/net/ftp/test_ftp.rb +++ b/test/net/ftp/test_ftp.rb @@ -2107,22 +2107,19 @@ EOF commands = [] sock = nil @thread = Thread.start do - begin - sock = server.accept - sock.print("220 (test_ftp).\r\n") - commands.push(sock.gets) - sock.print("234 AUTH success.\r\n") - rescue SystemCallError, IOError - # may be raised by broken connection - end + sock = server.accept + sock.print("220 (test_ftp).\r\n") + commands.push(sock.gets) + sock.print("234 AUTH success.\r\n") end begin assert_raise(Net::OpenTimeout) do Net::FTP.new("localhost", port: port, ssl: { ca_file: CA_FILE }, - open_timeout: 0.1) + ssl_handshake_timeout: 0.1) end + @thread.join ensure sock.close if sock server.close -- cgit v1.2.3