From 4eca898ab0df8873cb4c410edbefe6a14ca1df76 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 5 Oct 2016 16:15:33 +1100 Subject: [PATCH] fixed race in test --- .../eclipse/jetty/http2/client/SessionFailureTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/SessionFailureTest.java b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/SessionFailureTest.java index 1b6c60a9ce9..d6bc41c123f 100644 --- a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/SessionFailureTest.java +++ b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/SessionFailureTest.java @@ -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(); + } } }