neo4j/neo4j — pull request #3403 by digitalstain (2014-11-05 13:55:37+00:00)
Title: Fixes unstable NetworkSenderReceiverTest

The test occasionally failed because of a race condition between
sending a message from NetworkSender and stopping a NetworkReceiver
instance. The test depended on the message sent to result in a
ClosedChannelException which occasionally did not happen, because
NetworkReceiver.stop() does not block waiting for all listening
threads to exit. The result is that the message would be received
and the expected exception would not happen.
The fix adds a retry loop that keeps sending messages until the
exception manifests. Then it goes on to verify the actual
functionality