diff --git a/test/jdk/java/net/httpclient/http3/H3ErrorHandlingTest.java b/test/jdk/java/net/httpclient/http3/H3ErrorHandlingTest.java index 10a3a3af8f2..4315fd36de5 100644 --- a/test/jdk/java/net/httpclient/http3/H3ErrorHandlingTest.java +++ b/test/jdk/java/net/httpclient/http3/H3ErrorHandlingTest.java @@ -34,6 +34,7 @@ import jdk.internal.net.quic.QuicTransportException; import jdk.internal.net.quic.QuicVersion; import jdk.test.lib.net.SimpleSSLContext; import jdk.test.lib.net.URIBuilder; +import jdk.test.lib.Utils; import org.testng.IRetryAnalyzer; import org.testng.ITestResult; import org.testng.annotations.AfterClass; @@ -802,7 +803,7 @@ public class H3ErrorHandlingTest implements HttpServerAdapters { final HttpResponse response = client.sendAsync( request, BodyHandlers.discarding()) - .get(10, TimeUnit.SECONDS); + .get(Utils.adjustTimeout(10), TimeUnit.SECONDS); fail("Expected the request to fail, got " + response); } catch (Exception e) { final String expectedMsg = "stateless reset from peer"; @@ -943,7 +944,7 @@ public class H3ErrorHandlingTest implements HttpServerAdapters { final HttpResponse response = client.sendAsync( request, BodyHandlers.discarding()) - .get(10, TimeUnit.SECONDS); + .get(Utils.adjustTimeout(10), TimeUnit.SECONDS); fail("Expected the request to fail, got " + response); } catch (ExecutionException e) { System.out.println("Client exception [expected]: " + e); @@ -966,13 +967,13 @@ public class H3ErrorHandlingTest implements HttpServerAdapters { final HttpResponse response = client.sendAsync( request, BodyHandlers.discarding()) - .get(10, TimeUnit.SECONDS); + .get(Utils.adjustTimeout(20), TimeUnit.SECONDS); fail("Expected the request to fail, got " + response); } catch (ExecutionException e) { System.out.println("Client exception [expected]: " + e); var cause = e.getCause(); assertTrue(cause instanceof ProtocolException, "Expected ProtocolException"); - TerminationCause terminationCause = errorCF.get(10, TimeUnit.SECONDS); + TerminationCause terminationCause = errorCF.get(Utils.adjustTimeout(10), TimeUnit.SECONDS); System.out.println("Server reason: \"" + terminationCause.getPeerVisibleReason()+'"'); final long actual = terminationCause.getCloseCode(); // expected @@ -989,13 +990,13 @@ public class H3ErrorHandlingTest implements HttpServerAdapters { final HttpResponse response = client.sendAsync( request, BodyHandlers.discarding()) - .get(10, TimeUnit.SECONDS); + .get(Utils.adjustTimeout(10), TimeUnit.SECONDS); fail("Expected the request to fail, got " + response); } catch (ExecutionException e) { System.out.println("Client exception [expected]: " + e); var cause = e.getCause(); assertTrue(cause instanceof ProtocolException, "Expected ProtocolException"); - TerminationCause terminationCause = errorCF.get(10, TimeUnit.SECONDS); + TerminationCause terminationCause = errorCF.get(Utils.adjustTimeout(10), TimeUnit.SECONDS); System.out.println("Server reason: \"" + terminationCause.getPeerVisibleReason()+'"'); final long actual = terminationCause.getCloseCode(); // expected @@ -1019,13 +1020,13 @@ public class H3ErrorHandlingTest implements HttpServerAdapters { BodyHandlers.discarding(), (initiatingRequest, pushPromiseRequest, acceptor) -> acceptor.apply(BodyHandlers.discarding()) - ).get(10, TimeUnit.SECONDS); + ).get(Utils.adjustTimeout(10), TimeUnit.SECONDS); fail("Expected the request to fail, got " + response); } catch (ExecutionException e) { System.out.println("Client exception [expected]: " + e); var cause = e.getCause(); assertTrue(cause instanceof ProtocolException, "Expected ProtocolException"); - TerminationCause terminationCause = errorCF.get(10, TimeUnit.SECONDS); + TerminationCause terminationCause = errorCF.get(Utils.adjustTimeout(10), TimeUnit.SECONDS); System.out.println("Server reason: \"" + terminationCause.getPeerVisibleReason()+'"'); final long actual = terminationCause.getCloseCode(); // expected