use of io.netty.handler.ssl.SslContext in project vert.x by eclipse.
the class SSLHelperTest method testOpenSslServerSessionContext.
private void testOpenSslServerSessionContext(boolean testDefault) {
HttpServerOptions httpServerOptions = new HttpServerOptions().setOpenSslEngineOptions(new OpenSSLEngineOptions());
if (!testDefault) {
httpServerOptions.setOpenSslEngineOptions(new OpenSSLEngineOptions().setSessionCacheEnabled(false));
}
SSLHelper defaultHelper = new SSLHelper(httpServerOptions, Cert.SERVER_PEM.get(), Trust.SERVER_PEM.get());
SslContext ctx = defaultHelper.getContext((VertxInternal) vertx);
assertTrue(ctx instanceof OpenSslServerContext);
SSLSessionContext sslSessionContext = ctx.sessionContext();
assertTrue(sslSessionContext instanceof OpenSslServerSessionContext);
if (sslSessionContext instanceof OpenSslServerSessionContext) {
assertEquals(testDefault, ((OpenSslServerSessionContext) sslSessionContext).isSessionCacheEnabled());
}
}
use of io.netty.handler.ssl.SslContext in project vert.x by eclipse.
the class SSLHelperTest method testUseOpenSSLCiphersWhenNotSpecified.
@Test
public void testUseOpenSSLCiphersWhenNotSpecified() throws Exception {
Set<String> expected = OpenSsl.availableCipherSuites();
SSLHelper helper = new SSLHelper(new HttpClientOptions().setOpenSslEngineOptions(new OpenSSLEngineOptions()), Cert.CLIENT_PEM.get(), Trust.SERVER_PEM.get());
SslContext ctx = helper.getContext((VertxInternal) vertx);
assertEquals(expected, new HashSet<>(ctx.cipherSuites()));
}
use of io.netty.handler.ssl.SslContext in project vert.x by eclipse.
the class SSLHelperTest method testUseJdkCiphersWhenNotSpecified.
@Test
public void testUseJdkCiphersWhenNotSpecified() throws Exception {
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, null, null);
SSLEngine engine = context.createSSLEngine();
String[] expected = engine.getEnabledCipherSuites();
SSLHelper helper = new SSLHelper(new HttpClientOptions(), Cert.CLIENT_JKS.get(), Trust.SERVER_JKS.get());
SslContext ctx = helper.getContext((VertxInternal) vertx);
assertEquals(new HashSet<>(Arrays.asList(expected)), new HashSet<>(ctx.cipherSuites()));
}
use of io.netty.handler.ssl.SslContext in project grpc-java by grpc.
the class ConcurrencyTest method newClientChannel.
private ManagedChannel newClientChannel() throws CertificateException, IOException {
File clientCertChainFile = TestUtils.loadCert("client.pem");
File clientPrivateKeyFile = TestUtils.loadCert("client.key");
X509Certificate[] clientTrustedCaCerts = { TestUtils.loadX509Cert("ca.pem") };
SslContext sslContext = GrpcSslContexts.forClient().keyManager(clientCertChainFile, clientPrivateKeyFile).trustManager(clientTrustedCaCerts).build();
return NettyChannelBuilder.forAddress("localhost", server.getPort()).overrideAuthority(TestUtils.TEST_SERVER_HOST).negotiationType(NegotiationType.TLS).sslContext(sslContext).build();
}
use of io.netty.handler.ssl.SslContext in project grpc-java by grpc.
the class NettyChannelBuilderTest method failIfSslContextIsNotClient.
@Test
public void failIfSslContextIsNotClient() {
SslContext sslContext = mock(SslContext.class);
NettyChannelBuilder builder = new NettyChannelBuilder(new SocketAddress() {
});
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Server SSL context can not be used for client channel");
builder.sslContext(sslContext);
}
Aggregations