Skip to content

Commit ca76b19

Browse files
committed
Fix TLS configuration for Java 13.0.7
The private key loading fails sometimes on CI, this is a workaround.
1 parent 5b6c296 commit ca76b19

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/test/java/com/rabbitmq/stream/impl/TlsTest.java

+22
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,35 @@
4949
import javax.net.ssl.SSLException;
5050
import javax.net.ssl.SSLHandshakeException;
5151
import javax.net.ssl.SSLParameters;
52+
import org.junit.jupiter.api.AfterEach;
53+
import org.junit.jupiter.api.BeforeEach;
5254
import org.junit.jupiter.api.Test;
5355
import org.junit.jupiter.api.extension.ExtendWith;
5456

5557
@DisabledIfTlsNotEnabled
5658
@ExtendWith(TestUtils.StreamTestInfrastructureExtension.class)
5759
public class TlsTest {
5860

61+
static boolean isJava13() {
62+
String javaVersion = System.getProperty("java.version");
63+
return javaVersion != null && javaVersion.startsWith("13.");
64+
}
65+
66+
@BeforeEach
67+
public void init() {
68+
if (isJava13()) {
69+
// for Java 13.0.7, see https://github.com/bcgit/bc-java/issues/941
70+
System.setProperty("keystore.pkcs12.keyProtectionAlgorithm", "PBEWithHmacSHA256AndAES_256");
71+
}
72+
}
73+
74+
@AfterEach
75+
public void tearDown() throws Exception {
76+
if (isJava13()) {
77+
System.setProperty("keystore.pkcs12.keyProtectionAlgorithm", "");
78+
}
79+
}
80+
5981
String stream;
6082

6183
TestUtils.ClientFactory cf;

0 commit comments

Comments
 (0)