diff options
Diffstat (limited to 'test/test_linux_tcp_info.rb')
-rw-r--r-- | test/test_linux_tcp_info.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_linux_tcp_info.rb b/test/test_linux_tcp_info.rb index e008a92..1751dee 100644 --- a/test/test_linux_tcp_info.rb +++ b/test/test_linux_tcp_info.rb @@ -42,4 +42,20 @@ class TestLinuxTCP_Info < Test::Unit::TestCase ensure s.close end + + def test_tcp_server_delayed + delay = 0.010 + delay_ms = (delay * 1000).to_i + s = TCPServer.new(TEST_ADDR, 0) + c = TCPSocket.new TEST_ADDR, s.addr[1] + c.syswrite "." + sleep delay + a = s.accept + i = Raindrops::TCP_Info.new(a) + assert i.last_data_recv >= delay_ms, "#{i.last_data_recv} < #{delay_ms}" + ensure + c.close if c + a.close if a + s.close + end end |