summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
authorMasaki Matsushita <glass.saga@gmail.com>2020-09-25 16:20:18 +0900
committerMasaki Matsushita <glass.saga@gmail.com>2020-12-10 20:52:29 +0900
commit78f188524f551c97b1a7a44ae13514729f1a21c7 (patch)
treeeb334c023f4571b883221cbaa7a149352ac83b9c /test/socket
parent658b4ff60934b9fb6845e214fda83229e631e366 (diff)
downloadruby-78f188524f551c97b1a7a44ae13514729f1a21c7.tar.gz
Add connect_timeout to TCPSocket
Add connect_timeout to TCPSocket.new in the same way as Socket.tcp. Closes [Feature #17187]
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_tcp.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/socket/test_tcp.rb b/test/socket/test_tcp.rb
index 15c79b7519..a9e2a417a5 100644
--- a/test/socket/test_tcp.rb
+++ b/test/socket/test_tcp.rb
@@ -69,6 +69,12 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
end
end
+ def test_initialize_connect_timeout
+ assert_raise(Errno::ETIMEDOUT) do
+ TCPSocket.new("192.0.2.1", 80, connect_timeout: 0)
+ end
+ end
+
def test_recvfrom
TCPServer.open("localhost", 0) {|svr|
th = Thread.new {