fixed race in test

This commit is contained in:
Greg Wilkins 2016-10-05 16:15:33 +11:00
parent 4410610ef3
commit 4eca898ab0
1 changed files with 9 additions and 1 deletions

View File

@ -118,6 +118,14 @@ public class SessionFailureTest extends AbstractTest
Assert.assertTrue(writeLatch.await(5, TimeUnit.SECONDS));
Assert.assertTrue(serverFailureLatch.await(5, TimeUnit.SECONDS));
Assert.assertTrue(clientFailureLatch.await(5, TimeUnit.SECONDS));
Assert.assertFalse(((HTTP2Session)session).getEndPoint().isOpen());
long start = System.nanoTime();
long now = System.nanoTime();
while (((HTTP2Session)session).getEndPoint().isOpen())
{
if (TimeUnit.NANOSECONDS.toSeconds(now-start)>5)
Assert.fail();
Thread.sleep(10);
now = System.nanoTime();
}
}
}