Skip to content

Commit 4fea4b6

Browse files
authored
Merge pull request #1094 from quickfix-j/copilot/fix-ssl-certificate-test-failure
Fix intermittent `shouldFailWhenUsingEmptyServerKeyStore` test failure across platforms
2 parents bd4632d + 8a4182e commit 4fea4b6

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

quickfixj-core/src/test/java/quickfix/mina/ssl/SSLCertificateTest.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,23 @@ public class SSLCertificateTest {
8080

8181
private static final String LOCALHOST_ALIAS = "localhost-quickfixj";
8282

83+
// Cipher suites that require certificates (excludes anonymous suites)
84+
// This list provides compatibility across different JDK versions and platforms
85+
private static final String CERTIFICATE_REQUIRED_CIPHER_SUITES = String.join(",",
86+
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
87+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
88+
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
89+
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
90+
"TLS_RSA_WITH_AES_128_GCM_SHA256",
91+
"TLS_RSA_WITH_AES_256_GCM_SHA384",
92+
"TLS_RSA_WITH_AES_128_CBC_SHA256",
93+
"TLS_RSA_WITH_AES_256_CBC_SHA256",
94+
"TLS_RSA_WITH_AES_128_CBC_SHA",
95+
"TLS_RSA_WITH_AES_256_CBC_SHA",
96+
"TLS_AES_128_GCM_SHA256",
97+
"TLS_AES_256_GCM_SHA384"
98+
);
99+
83100
@Parameters
84101
public static List<Object[]> parameters() {
85102
return Arrays.asList(new String[][]{{"TLS_RSA_WITH_AES_128_CBC_SHA", "TLSv1.2"}, {"TLS_AES_256_GCM_SHA384", "TLSv1.3"}});
@@ -794,13 +811,13 @@ public void shouldFailIndividualSessionsWhenInvalidCertificatesUsed() throws Exc
794811
public void shouldFailWhenUsingEmptyServerKeyStore() throws Exception {
795812
int freePort = AvailablePortFinder.getNextAvailable();
796813
TestAcceptor acceptor = new TestAcceptor(createAcceptorSettings("single-session/empty.keystore", false,
797-
"single-session/empty.keystore", null, null, "JKS", "JKS", freePort));
814+
"single-session/empty.keystore", CERTIFICATE_REQUIRED_CIPHER_SUITES, "TLSv1.2,TLSv1.3", "JKS", "JKS", freePort));
798815

799816
try {
800817
acceptor.start();
801818

802819
TestInitiator initiator = new TestInitiator(createInitiatorSettings("single-session/empty.keystore",
803-
"single-session/empty.keystore", null, null, "ZULU", "ALFA", Integer.toString(freePort), "JKS", "JKS"));
820+
"single-session/empty.keystore", CERTIFICATE_REQUIRED_CIPHER_SUITES, "TLSv1.2,TLSv1.3", "ZULU", "ALFA", Integer.toString(freePort), "JKS", "JKS"));
804821

805822
try {
806823
initiator.start();
@@ -992,7 +1009,7 @@ public void shouldConnectDifferentTypesOfSessions() throws Exception {
9921009

9931010
static abstract class TestConnector {
9941011
private static final Logger LOGGER = LoggerFactory.getLogger(TestConnector.class);
995-
private static final int TIMEOUT_SECONDS = 5;
1012+
private static final int TIMEOUT_SECONDS = 15;
9961013

9971014
private final SessionConnector connector;
9981015
private final CountDownLatch exceptionThrownLatch;

0 commit comments

Comments
 (0)