diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/socket/test_addrinfo.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index c0aeba6f76..3240b9d814 100644 --- a/test/socket/test_addrinfo.rb +++ b/test/socket/test_addrinfo.rb @@ -352,6 +352,24 @@ class TestSocketAddrinfo < Test::Unit::TestCase # not test failure end } + + TCPServer.open("0.0.0.0", 0) {|serv| + serv_ai = Addrinfo.new(serv.getsockname, :INET, :STREAM) + serv_ai = tcp_unspecified_to_loopback(serv_ai) + port = random_port + begin + serv_ai.connect_from(Addrinfo.tcp("0.0.0.0", port)) {|s1| + s2 = serv.accept + begin + assert_equal(port, s2.remote_address.ip_port) + ensure + s2.close + end + } + rescue *errors_addrinuse + # not test failure + end + } end def test_connect_to |