use of io.vertx.core.net.OpenSSLEngineOptions 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.vertx.core.net.OpenSSLEngineOptions 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.vertx.core.net.OpenSSLEngineOptions in project vert.x by eclipse.
the class Http2Test method testServerOpenSSL.
@Test
public void testServerOpenSSL() throws Exception {
HttpServerOptions opts = new HttpServerOptions().setPort(DEFAULT_HTTPS_PORT).setHost(DEFAULT_HTTPS_HOST).setUseAlpn(true).setSsl(true).addEnabledCipherSuite(// Non Diffie-helman -> debuggable in wireshark
"TLS_RSA_WITH_AES_128_CBC_SHA").setPemKeyCertOptions(Cert.SERVER_PEM.get()).setSslEngineOptions(new OpenSSLEngineOptions());
server.close();
client.close();
client = vertx.createHttpClient(createBaseClientOptions());
server = vertx.createHttpServer(opts);
server.requestHandler(req -> {
req.response().end();
});
CountDownLatch latch = new CountDownLatch(1);
System.out.println("starting");
try {
server.listen(onSuccess(v -> latch.countDown()));
} catch (Throwable e) {
e.printStackTrace();
}
System.out.println("listening");
awaitLatch(latch);
client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp -> {
assertEquals(200, resp.statusCode());
testComplete();
}).exceptionHandler(this::fail).end();
await();
}
Aggregations