diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/EventsHandlerTest.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/EventsHandlerTest.java index 0ecb573c398..e647ef93ac1 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/EventsHandlerTest.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/EventsHandlerTest.java @@ -111,7 +111,7 @@ public class EventsHandlerTest String response = connector.getResponse(rawRequest); assertThat(response, containsString("HTTP/1.1 200 OK")); - await().atMost(3, TimeUnit.SECONDS).until(attribute::get, is("testModifyRequestAttributes-123")); + await().atMost(5, TimeUnit.SECONDS).until(attribute::get, is("testModifyRequestAttributes-123")); } @Test @@ -233,6 +233,8 @@ public class EventsHandlerTest String response = connector.getResponse(rawRequest); assertThat(response, containsString("HTTP/1.1 200 OK")); - assertThat(events, equalTo(Arrays.asList("onBeforeHandling", "onAfterHandling", "onResponseBegin", "onComplete"))); + await().atMost(5, TimeUnit.SECONDS).untilAsserted(() -> + assertThat(events, equalTo(Arrays.asList("onBeforeHandling", "onAfterHandling", "onResponseBegin", "onComplete")) + )); } } diff --git a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/EventsHandlerTest.java b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/EventsHandlerTest.java index 6fa6d887243..9df590d00aa 100644 --- a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/EventsHandlerTest.java +++ b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/EventsHandlerTest.java @@ -198,7 +198,7 @@ public class EventsHandlerTest extends AbstractTest assertThat(response.getStatus(), is(200)); assertThat(response.getContentAsString(), is("ABCDEF")); assertThat(stringBuffer.toString(), is("ABCDEF")); - assertThat(failures.size(), is(0)); + await().atMost(5, TimeUnit.SECONDS).during(1, TimeUnit.SECONDS).until(failures::size, is(0)); } @ParameterizedTest @@ -394,56 +394,48 @@ public class EventsHandlerTest extends AbstractTest @Override protected void onBeforeHandling(Request request) { -// System.out.println("onBeforeHandling"); useForbiddenMethods(request, exceptions); } @Override protected void onRequestRead(Request request, Content.Chunk chunk) { -// System.out.println("onRequestRead " + chunk); useForbiddenMethods(request, exceptions); } @Override protected void onAfterHandling(Request request, boolean handled, Throwable failure) { -// System.out.println("onAfterHandling"); useForbiddenMethods(request, exceptions); } @Override protected void onResponseBegin(Request request, int status, HttpFields headers) { -// System.out.println("onResponseBegin"); useForbiddenMethods(request, exceptions); } @Override protected void onResponseWrite(Request request, boolean last, ByteBuffer content) { -// System.out.println("onResponseWrite"); useForbiddenMethods(request, exceptions); } @Override protected void onResponseWriteComplete(Request request, Throwable failure) { -// System.out.println("onResponseWriteComplete"); useForbiddenMethods(request, exceptions); } @Override protected void onResponseTrailersComplete(Request request, HttpFields trailers) { -// System.out.println("onResponseTrailersComplete"); useForbiddenMethods(request, exceptions); } @Override protected void onComplete(Request request, int status, HttpFields headers, Throwable failure) { -// System.out.println("onComplete"); useForbiddenMethods(request, exceptions); }