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.
|
|
|
|
|
2012-06-27 17:28:24 +01:00
|
|
|
require 'flexnbd/fake_source'
|
2012-07-03 14:39:05 +01:00
|
|
|
include FlexNBD
|
2012-06-22 10:05:41 +01:00
|
|
|
|
|
|
|
addr, port = *ARGV
|
|
|
|
|
2018-02-02 21:34:14 +00:00
|
|
|
client = FakeSource.new(addr, port, 'Timed out connecting.')
|
2012-07-03 14:39:05 +01:00
|
|
|
client.read_hello
|
|
|
|
client.close
|
|
|
|
|
2012-06-22 10:05:41 +01:00
|
|
|
sleep(0.2)
|
2012-07-03 14:39:05 +01:00
|
|
|
|
2018-02-02 21:34:14 +00:00
|
|
|
FakeSource.new(addr, port, 'Timed out reconnecting.')
|
2012-06-22 10:05:41 +01:00
|
|
|
|
|
|
|
exit(0)
|