Hardcode TLS version used during blockhound tests (#10162)

Motivation:

Different versions of the JDK use different TLS versions by default. We should define the versions explicit

Modifications:

Explicit specify TLSv1.2

Result:

Blockhound tests pass on JDK14 as well
This commit is contained in:
Norman Maurer 2020-04-03 14:40:15 +02:00 committed by GitHub
parent 21f375fa90
commit c90acf4766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask; import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -155,13 +154,14 @@ public class NettyBlockHoundIntegrationTest {
} }
private static void testHandshakeWithExecutor(Executor executor) throws Exception { private static void testHandshakeWithExecutor(Executor executor) throws Exception {
String tlsVersion = "TLSv1.2";
final SslContext sslClientCtx = SslContextBuilder.forClient() final SslContext sslClientCtx = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE) .trustManager(InsecureTrustManagerFactory.INSTANCE)
.sslProvider(SslProvider.JDK).build(); .sslProvider(SslProvider.JDK).protocols(tlsVersion).build();
final SelfSignedCertificate cert = new SelfSignedCertificate(); final SelfSignedCertificate cert = new SelfSignedCertificate();
final SslContext sslServerCtx = SslContextBuilder.forServer(cert.key(), cert.cert()) final SslContext sslServerCtx = SslContextBuilder.forServer(cert.key(), cert.cert())
.sslProvider(SslProvider.JDK).build(); .sslProvider(SslProvider.JDK).protocols(tlsVersion).build();
EventLoopGroup group = new NioEventLoopGroup(); EventLoopGroup group = new NioEventLoopGroup();
Channel sc = null; Channel sc = null;