1 # -*- encoding: binary -*-
6 $stderr.sync = $stdout.sync = true
8 class TestLinuxAllTcpListenStats < Test::Unit::TestCase
9 include Raindrops::Linux
10 TEST_ADDR = ENV['UNICORN_TEST_ADDR'] || '127.0.0.1'
14 pp Raindrops::Linux.tcp_listener_stats
23 @socks.each { |io| io.closed? or io.close }
27 s = TCPServer.new TEST_ADDR, 0
33 s = TCPSocket.new("127.0.0.1", port)
45 srv, port = new_server
46 addr = "#{TEST_ADDR}:#{port}"
47 all = Raindrops::Linux.tcp_listener_stats
48 assert_equal [0,0], all[addr].to_a
51 all = Raindrops::Linux.tcp_listener_stats
52 assert_equal [0,1], all[addr].to_a
55 all = Raindrops::Linux.tcp_listener_stats
56 assert_equal [0,2], all[addr].to_a
59 all = Raindrops::Linux.tcp_listener_stats
60 assert_equal [1,1], all[addr].to_a
63 all = Raindrops::Linux.tcp_listener_stats
64 assert_equal [2,0], all[addr].to_a
66 end if RUBY_PLATFORM =~ /linux/