This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 9d125ba913 Speed up TestPQC by connecting s_client to the connector's
address
9d125ba913 is described below
commit 9d125ba913cecc6258fec36bd82a05c8d13a2e54
Author: Mark Thomas <[email protected]>
AuthorDate: Sun Nov 8 10:03:33 2026 +0000
Speed up TestPQC by connecting s_client to the connector's address
The connector only listens on the address that "localhost" resolves to
in Java (typically 127.0.0.1) but s_client may try other addresses
(e.g. ::1) first. On Windows a refused connection takes ~2s, adding
that delay to every test using s_client.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
test/org/apache/tomcat/util/net/TestPQC.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/test/org/apache/tomcat/util/net/TestPQC.java
b/test/org/apache/tomcat/util/net/TestPQC.java
index 2e6bedfa55..1f0fb793eb 100644
--- a/test/org/apache/tomcat/util/net/TestPQC.java
+++ b/test/org/apache/tomcat/util/net/TestPQC.java
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.net;
import java.io.File;
+import java.net.Inet6Address;
+import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -305,7 +307,19 @@ public class TestPQC extends TomcatBaseTest {
cmd.add(openSSLPath);
cmd.add("s_client");
cmd.add("-connect");
- cmd.add("localhost:" + getPort());
+ /*
+ * Connect using the address the connector is listening on rather than
"localhost". If "localhost" resolves
+ * to multiple addresses, s_client may try one the connector isn't
listening on first and, on some platforms
+ * (e.g. Windows), a refused connection takes ~2s.
+ */
+ InetAddress address = InetAddress.getByName("localhost");
+ String host = address.getHostAddress();
+ if (address instanceof Inet6Address) {
+ host = "[" + host + "]";
+ }
+ cmd.add(host + ":" + getPort());
+ cmd.add("-servername");
+ cmd.add("localhost");
cmd.add("-CAfile");
cmd.add(caFile);
cmd.add("-tls1_3");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]