elharo opened a new pull request, #2037: URL: https://github.com/apache/maven-resolver/pull/2037
Fixes #2036 ## Problem `JettyTransporterTest.testGet_HTTP3` is flaky: binding the HTTP/3 (UDP) connector to the HTTPS TCP connector's port fails with `java.net.BindException: Address already in use`. ## Root cause The test bound both connectors to the same numeric port by reusing `getHttpsPort()`, which is an OS-assigned *TCP* port. TCP and UDP port spaces are allocated independently, so the same-numbered *UDP* port may already be in use by another process. The collision is inherent to the "let the OS pick a TCP port, then force UDP onto the same number" pattern (verified by experiment: ~1% collision rate with a few hundred UDP sockets occupied). ## Fix - Added `HttpServer.findFreeTcpAndUdpPort()`, which probes for a port that is free for **both** TCP and UDP. - Added `HttpServer.addHttp2OnlyConnectorWithMutualTLS(int port)` so the HTTPS (HTTP/2) connector can be bound to that exact port. - `testGet_HTTP3` now reserves such a port and binds both connectors to it, keeping the intended "HTTP/2 and HTTP/3 on the same port" semantics. Verified: `JettyTransporterTest` (89 tests), `ApacheTransporterTest` (93), and `JdkTransporterTest` (92) all pass; the HTTP/3 requests in `testGet_HTTP3` are served over HTTP/3.0. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
