connect failure scenarios

This commit is contained in:
Alex Young
2012-06-22 10:05:41 +01:00
parent 80f298f6cd
commit 2078d17053
28 changed files with 1674 additions and 225 deletions

22
tests/fakes/dest/reject_acl.rb Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env ruby
# Accept a connection, then immediately close it. This simulates an ACL rejection.
addr, port = *ARGV
require 'socket'
require 'timeout'
serve_sock = TCPServer.open( addr, port )
begin
Timeout.timeout( 2 ) do
serve_sock.accept.close
end
rescue Timeout::Error
$stderr.puts "Timed out waiting for a connection"
exit 1
end
serve_sock.close
exit(0)