diff --git a/jetty-core/jetty-tests/jetty-test-client-transports/pom.xml b/jetty-core/jetty-tests/jetty-test-client-transports/pom.xml index 7c34aa4131b9..348585e02b1f 100644 --- a/jetty-core/jetty-tests/jetty-test-client-transports/pom.xml +++ b/jetty-core/jetty-tests/jetty-test-client-transports/pom.xml @@ -86,6 +86,22 @@ + + enable-foreign + + [22,) + + + + + maven-surefire-plugin + + @{argLine} ${jetty.surefire.argLine} --enable-native-access=ALL-UNNAMED + + + + + diff --git a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientStreamTest.java b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientStreamTest.java index 703bc69c6f28..216b24cc1190 100644 --- a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientStreamTest.java +++ b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientStreamTest.java @@ -1063,9 +1063,7 @@ public void close() throws IOException @MethodSource("transports") public void testUploadWithPendingReadConcurrentServerCloseClosesStream(Transport transport) throws Exception { - CountDownLatch serverDemandLatch = new CountDownLatch(1); CountDownLatch serverLatch = new CountDownLatch(1); - AtomicReference lastChunk = new AtomicReference<>(); start(transport, new Handler.Abstract() { @Override @@ -1076,16 +1074,14 @@ public boolean handle(Request request, org.eclipse.jetty.server.Response respons @Override public void run() { + // With H2, once the connector is stopping, there is no guarantee that the demand will be serviced + // as the execution strategy is busy shutting down but is needed to run the dispatched thread that + // services the demand; so we cannot expect that a last chunk will be read here. Content.Chunk chunk = request.read(); if (chunk != null) chunk.release(); if (chunk == null || !chunk.isLast()) - { request.demand(this); - return; - } - lastChunk.set(chunk); - serverDemandLatch.countDown(); } }); serverLatch.countDown(); @@ -1149,9 +1145,6 @@ public void close() throws IOException assertTrue(completeLatch.await(5, TimeUnit.SECONDS)); assertTrue(closeLatch.await(5, TimeUnit.SECONDS)); - assertTrue(serverDemandLatch.await(5, TimeUnit.SECONDS)); - assertTrue(Content.Chunk.isFailure(lastChunk.get(), true)); - assertInstanceOf(IOException.class, lastChunk.get().getFailure()); } @ParameterizedTest