diff --git a/_test/ReflectorClient.rb b/_test/ReflectorClient.rb index c22858984..acc8acc72 100644 --- a/_test/ReflectorClient.rb +++ b/_test/ReflectorClient.rb @@ -67,11 +67,15 @@ def @reflector.waitConnectAction(cid) end def @reflector.waitDisconnectAction(cid) - socket = @sockets[cid] - if IO.select([socket], nil, nil, 10) == nil then - raise "Connection hangs after ten seconds." - elsif !socket.eof? then - raise "Expected disconnection, got data" + begin + socket = @sockets[cid] + if IO.select([socket], nil, nil, 10) == nil then + raise "Connection hangs after ten seconds." + elsif !socket.eof? then + raise "Expected disconnection, got data" + end + rescue Errno::ECONNRESET + # Ignore, server has already disconnected the socket end end diff --git a/_test/ReflectorServer.rb b/_test/ReflectorServer.rb index 184c77ca7..43113157d 100644 --- a/_test/ReflectorServer.rb +++ b/_test/ReflectorServer.rb @@ -58,10 +58,14 @@ def @reflector.waitConnectAction(cid) end def @reflector.waitDisconnectAction(cid) - if IO.select([@socket], nil, nil, 10) == nil then - raise "Connection hangs after five seconds." - elsif !@socket.eof? then - raise "Expected disconnection, got data" + begin + if IO.select([@socket], nil, nil, 10) == nil then + raise "Connection hangs after five seconds." + elsif !@socket.eof? then + raise "Expected disconnection, got data" + end + rescue Errno::ECONNRESET + # Ignore, client has already disconnected the socket end end