Skip to content

Commit cc7c867

Browse files
committed
Fix TLS configuration for Java 13.0.7
1 parent e3ae28c commit cc7c867

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.eclipse.jetty.server.handler.ContextHandler;
2929
import org.eclipse.jetty.util.ssl.SslContextFactory;
3030
import org.junit.After;
31+
import org.junit.Before;
3132
import org.junit.Test;
3233

3334
import javax.net.ssl.SSLContext;
@@ -56,8 +57,24 @@ public class OAuth2ClientCredentialsGrantCredentialsProviderTest {
5657

5758
Server server;
5859

60+
static boolean isJava13() {
61+
String javaVersion = System.getProperty("java.version");
62+
return javaVersion != null && javaVersion.startsWith("13.");
63+
}
64+
65+
@Before
66+
public void init() {
67+
if (isJava13()) {
68+
// for Java 13.0.7, see https://github.com/bcgit/bc-java/issues/941
69+
System.setProperty("keystore.pkcs12.keyProtectionAlgorithm", "PBEWithHmacSHA256AndAES_256");
70+
}
71+
}
72+
5973
@After
6074
public void tearDown() throws Exception {
75+
if (isJava13()) {
76+
System.setProperty("keystore.pkcs12.keyProtectionAlgorithm", "");
77+
}
6178
if (server != null) {
6279
server.stop();
6380
}

0 commit comments

Comments
 (0)