improved test timing

This commit is contained in:
Greg Wilkins 2012-01-11 16:39:03 +11:00
parent 1697fcfa5a
commit c5e3ed5afe
1 changed files with 3 additions and 2 deletions

View File

@ -95,10 +95,11 @@ public class SafariWebsocketDraft0Test
CaptureSocket socket = servlet.captures.get(0);
Assert.assertThat("CaptureSocket",socket,notNullValue());
Assert.assertThat("CaptureSocket.isConnected", socket.awaitConnected(1000), is(true));
Assert.assertThat("CaptureSocket.isConnected", socket.awaitConnected(10000), is(true));
// Give servlet time to process messages
threadSleep(1,TimeUnit.SECONDS);
for (int i=0;i<100 && socket.messages.size()<5;i++)
threadSleep(100,TimeUnit.MILLISECONDS);
// Should have captured 5 messages.
Assert.assertThat("CaptureSocket.messages.size",socket.messages.size(),is(5));