Files
flexnbd-c/tests/acceptance/fakes/source/close_after_hello.rb

23 lines
525 B
Ruby
Raw Normal View History

2012-06-22 10:05:41 +01:00
#!/usr/bin/env ruby
# Connect, read the hello, then immediately disconnect. This
# simulates a sender which dislikes something in the hello message - a
# wrong size, for instance.
# After the disconnect, we reconnect to be sure that the destination
# is still alive.
require 'flexnbd/fake_source'
include FlexNBD::FakeSource
2012-06-22 10:05:41 +01:00
addr, port = *ARGV
client_sock = connect( addr, port, "Timed out connecting." )
read_hello( client_sock )
2012-06-22 10:05:41 +01:00
client_sock.close
sleep(0.2)
connect( addr, port, "Timed out reconnecting." )
2012-06-22 10:05:41 +01:00
exit(0)