Fix SslTransportLayerTest.testUnsupportedCiphers to work with Java 11
Java 11 supports TLS 1.3 which has different cipher names than
previous TLS versions so the simplistic way of choosing ciphers
is not guaranteed to work. Fix it by configuring the context
to use TLS 1.2.
Reviewers: Rajini Sivaram
@@ -543,7 +543,9 @@ public class SslTransportLayerTest {
@Test
public void testUnsupportedCiphers() throws Exception {
String node = "0";
- String[] cipherSuites = SSLContext.getDefault().getDefaultSSLParameters().getCipherSuites();
+ SSLContext context = SSLContext.getInstance("TLSv1.2");
+ context.init(null, null, null);
+ String[] cipherSuites = context.getDefaultSSLParameters().getCipherSuites();
sslServerConfigs.put(SslConfigs.SSL_CIPHER_SUITES_CONFIG, Arrays.asList(cipherSuites[0]));
server = createEchoServer(SecurityProtocol.SSL);
