You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2025/12/07 10:30:19 UTC

(httpcomponents-client) branch 5.6.x updated (974f20aa8 -> d2fadd2f0)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch 5.6.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


 discard 974f20aa8 Tag TLS handshake timeout tests with `slow`
 discard d0a2c0137 TestTlsHandshakeTimeout: Disable assertions on Java 8
     new 77f52f0e3 Upgraded HttpClient version to 5.6-alpha2-SNAPSHOT
     new e52e46668 TestTlsHandshakeTimeout: Disable assertions on Java 8
     new d2fadd2f0 Tag TLS handshake timeout tests with `slow`

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (974f20aa8)
            \
             N -- N -- N   refs/heads/5.6.x (d2fadd2f0)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 httpclient5-cache/pom.xml       | 2 +-
 httpclient5-fluent/pom.xml      | 2 +-
 httpclient5-observation/pom.xml | 2 +-
 httpclient5-testing/pom.xml     | 2 +-
 httpclient5/pom.xml             | 2 +-
 pom.xml                         | 4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)


(httpcomponents-client) 02/03: TestTlsHandshakeTimeout: Disable assertions on Java 8

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 5.6.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit e52e46668ff3463745c0e8c1973212ed01289ece
Author: Ryan Schmitt <rs...@apache.org>
AuthorDate: Sun Oct 26 02:34:45 2025 -0700

    TestTlsHandshakeTimeout: Disable assertions on Java 8
    
    (cherry picked from commit 8767978952506c6792d117aab19fdedb68110bd7)
---
 .../testing/sync/TestTlsHandshakeTimeout.java      | 27 +++++++++-------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java
index b763a71f5..ca93b2c63 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java
@@ -47,7 +47,6 @@
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
-import javax.net.ssl.SSLException;
 import java.time.Duration;
 import java.time.temporal.ChronoUnit;
 
@@ -55,7 +54,6 @@
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.apache.hc.core5.util.ReflectionUtils.determineJRELevel;
-import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assumptions.assumeFalse;
@@ -97,23 +95,20 @@ void testTimeout(final boolean sendServerHello) throws Exception {
 
     @SuppressWarnings("deprecation")
     private static void assertTimeout(final ClassicHttpRequest request, final HttpClient client) {
-        final long startTime = System.nanoTime();
-        final Exception ex = assertThrows(Exception.class, () -> client.execute(request));
-        final Duration actualTime = Duration.of(System.nanoTime() - startTime, ChronoUnit.NANOS);
+        // There is a bug in Java 11, and some releases of Java 8: after the
+        // handshake times out, the SSLSocket implementation performs a
+        // blocking read on the socket to wait for close_notify or alert. This
+        // operation blocks until the read times out, which means that TLS
+        // handshakes take twice as long to time out on Java 11. Without a
+        // workaround, the only option is to skip the timeout assertions on
+        // older versions of Java.
+        assumeFalse(determineJRELevel() <= 11, "TLS handshake timeouts are buggy on Java 11 and earlier");
 
-        if (determineJRELevel() == 8) {
-            assertInstanceOf(SSLException.class, ex);
-        } else {
-            assertInstanceOf(ConnectTimeoutException.class, ex);
-        }
+        final long startTime = System.nanoTime();
+        final ConnectTimeoutException ex = assertThrows(ConnectTimeoutException.class, () -> client.execute(request));
         assertTrue(ex.getMessage().contains("Read timed out"), ex.getMessage());
 
-        // There is a bug in Java 11: after the handshake times out, the SSLSocket implementation performs a blocking
-        // read on the socket to wait for close_notify or alert. This operation blocks until the read times out,
-        // which means that TLS handshakes take twice as long to time out on Java 11. Without a workaround, the only
-        // option is to skip the timeout duration assertions on Java 11.
-        assumeFalse(determineJRELevel() == 11, "TLS handshake timeouts are buggy on Java 11");
-
+        final Duration actualTime = Duration.of(System.nanoTime() - startTime, ChronoUnit.NANOS);
         assertTrue(actualTime.toMillis() > EXPECTED_TIMEOUT.toMillis() / 2,
             format("Handshake attempt timed out too soon (only %,d out of %,d ms)",
                 actualTime.toMillis(),


(httpcomponents-client) 03/03: Tag TLS handshake timeout tests with `slow`

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 5.6.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit d2fadd2f0ecb2905ea869be8cf1b984b9562714a
Author: Ryan Schmitt <rs...@apache.org>
AuthorDate: Sun Oct 26 13:02:31 2025 -0700

    Tag TLS handshake timeout tests with `slow`
    
    These tests don't run reliably on the GitHub CI fleet. I am marking them
    with `@Tag("slow")`, which will cause them to run only when the
    `slow-tests` Maven profile is enabled. We can do the same with any other
    timing-sensitive tests that fail spuriously when running on shared build
    fleets.
    
    (cherry picked from commit 929f5216ea594c36d2a7d0a4d059d1b78a3a70c3)
---
 .../apache/hc/client5/testing/async/TestAsyncTlsHandshakeTimeout.java   | 2 ++
 .../org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java     | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestAsyncTlsHandshakeTimeout.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestAsyncTlsHandshakeTimeout.java
index ee0583787..aca39d38d 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestAsyncTlsHandshakeTimeout.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestAsyncTlsHandshakeTimeout.java
@@ -38,6 +38,7 @@
 import org.apache.hc.client5.testing.tls.TlsHandshakeTimeoutServer;
 import org.apache.hc.core5.reactor.IOReactorConfig;
 import org.apache.hc.core5.util.TimeValue;
+import org.junit.jupiter.api.Tag;
 import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
@@ -57,6 +58,7 @@
 public class TestAsyncTlsHandshakeTimeout {
     private static final Duration EXPECTED_TIMEOUT = Duration.ofMillis(500);
 
+    @Tag("slow")
     @Timeout(5)
     @ParameterizedTest
     @ValueSource(strings = { "false", "true" })
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java
index ca93b2c63..a11378e31 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestTlsHandshakeTimeout.java
@@ -43,6 +43,7 @@
 import org.apache.hc.client5.testing.tls.TlsHandshakeTimeoutServer;
 import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.io.SocketConfig;
+import org.junit.jupiter.api.Tag;
 import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
@@ -61,6 +62,7 @@
 public class TestTlsHandshakeTimeout {
     private static final Duration EXPECTED_TIMEOUT = Duration.ofMillis(500);
 
+    @Tag("slow")
     @Timeout(5)
     @ParameterizedTest
     @ValueSource(strings = { "false", "true" })