Files
flexnbd-c/tests/acceptance/fakes/dest/hello_wrong_magic.rb
Patrick J Cherry 9c48da82cc Rubocop
2018-02-02 21:34:14 +00:00

29 lines
560 B
Ruby
Executable File

#!/usr/bin/env ruby
# Simulate a destination which sends the wrong magic.
require 'flexnbd/fake_dest'
include FlexNBD
Thread.abort_on_exception
addr, port = *ARGV
server = FakeDest.new(addr, port)
client1 = server.accept
# We don't expect a reconnection attempt.
t = Thread.new do
begin
client2 = server.accept('Timed out waiting for a reconnection',
FlexNBD::MS_RETRY_DELAY_SECS + 1)
raise 'Unexpected reconnection'
rescue Timeout::Error
# expected
end
end
client1.write_hello(magic: :wrong)
t.join
exit 0