I would like to see a stronger guarantee that the data has been processed through the DummyClient than just Thread.sleep(100L). Maybe you can make the whole test timeout in 60 seconds, and poll the server.messagesReceived variable until it reaches size()?