This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch bugfix/failing-connection-check-for-urltransporter in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
commit 7969e5c88eec01feca514884325f09b0ff9a05ad Author: Konrad Windszus <[email protected]> AuthorDate: Sat Jul 18 11:43:18 2026 +0200 Do not check UrlTransporter for open connections after close Connection pooling for HttpUrlTransporter is managed by JRE with no way to explicitly close idle connections (compare with https://docs.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html) --- .../internal/test/util/http/HttpTransporterTest.java | 14 ++++++++++++-- .../eclipse/aether/transport/url/UrlTransporterTest.java | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java b/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java index 46d9e6afb..f0d54e491 100644 --- a/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java +++ b/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpTransporterTest.java @@ -307,8 +307,10 @@ public abstract class HttpTransporterTest { closer = null; } if (httpServer != null) { - // check for leaked connections (e.g., due to not closing response body streams) - Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> httpServer.getNumConnectedEndPoints() == 0); + if (closesAllConnectionsOnTransporterClose()) { + // check for leaked connections (e.g., due to not closing response body streams) + Awaitility.await().atMost(3, TimeUnit.SECONDS).until(() -> httpServer.getNumConnectedEndPoints() == 0); + } httpServer.stop(); httpServer = null; } @@ -316,6 +318,14 @@ public abstract class HttpTransporterTest { session = null; } + /** + * Indicates whether the transporter implementation closes all connections when the transporter is closed. + * @return {@code true} if all connections are closed on transporter close, {@code false} otherwise. + */ + protected boolean closesAllConnectionsOnTransporterClose() { + return true; + } + /** * Indicates whether the transporter implementation supports preemptive authentication (i.e., sending credentials with the first request). * @return {@code true} if preemptive authentication is supported, {@code false} otherwise. diff --git a/maven-resolver-transport-url/src/test/java/org/eclipse/aether/transport/url/UrlTransporterTest.java b/maven-resolver-transport-url/src/test/java/org/eclipse/aether/transport/url/UrlTransporterTest.java index 81b64e0ea..c1fb672bc 100644 --- a/maven-resolver-transport-url/src/test/java/org/eclipse/aether/transport/url/UrlTransporterTest.java +++ b/maven-resolver-transport-url/src/test/java/org/eclipse/aether/transport/url/UrlTransporterTest.java @@ -34,6 +34,12 @@ class UrlTransporterTest extends HttpTransporterTest { super(() -> new UrlTransporterFactory(standardChecksumExtractor(), new PathProcessorSupport())); } + @Override + protected boolean closesAllConnectionsOnTransporterClose() { + // compare with https://docs.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html + return false; + } + @Override protected Stream<String> supportedCompressionAlgorithms() { return Stream.of("gzip", "deflate");
