diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-03-04 17:08:13 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-03-04 17:08:13 -0800 |
commit | 96c8be2ea8830e2eb3a9108f501df52c21b42546 (patch) | |
tree | 5d29dbffaeaa0a7fcab046c987e9c9e987bd0a81 | |
parent | 4372cf8ef8203c93632cdaf163a1c923075e7d0f (diff) | |
download | raindrops-96c8be2ea8830e2eb3a9108f501df52c21b42546.tar.gz |
-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 |