Search in sources :

Example 1 with OpenSslServerContext

use of io.netty.handler.ssl.OpenSslServerContext 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());
    }
}
Also used : SSLHelper(io.vertx.core.net.impl.SSLHelper) SSLSessionContext(javax.net.ssl.SSLSessionContext) OpenSslServerContext(io.netty.handler.ssl.OpenSslServerContext) HttpServerOptions(io.vertx.core.http.HttpServerOptions) OpenSslServerSessionContext(io.netty.handler.ssl.OpenSslServerSessionContext) OpenSSLEngineOptions(io.vertx.core.net.OpenSSLEngineOptions) SslContext(io.netty.handler.ssl.SslContext)

Example 2 with OpenSslServerContext

use of io.netty.handler.ssl.OpenSslServerContext in project netty by netty.

the class SocketSslClientRenegotiateTest method data.

@Parameters(name = "{index}: serverEngine = {0}, clientEngine = {1}")
public static Collection<Object[]> data() throws Exception {
    List<SslContext> serverContexts = new ArrayList<SslContext>();
    List<SslContext> clientContexts = new ArrayList<SslContext>();
    clientContexts.add(new JdkSslClientContext(CERT_FILE));
    boolean hasOpenSsl = OpenSsl.isAvailable();
    if (hasOpenSsl) {
        OpenSslServerContext context = new OpenSslServerContext(CERT_FILE, KEY_FILE);
        context.setRejectRemoteInitiatedRenegotiation(true);
        serverContexts.add(context);
    } else {
        logger.warn("OpenSSL is unavailable and thus will not be tested.", OpenSsl.unavailabilityCause());
    }
    List<Object[]> params = new ArrayList<Object[]>();
    for (SslContext sc : serverContexts) {
        for (SslContext cc : clientContexts) {
            for (int i = 0; i < 32; i++) {
                params.add(new Object[] { sc, cc });
            }
        }
    }
    return params;
}
Also used : JdkSslClientContext(io.netty.handler.ssl.JdkSslClientContext) OpenSslServerContext(io.netty.handler.ssl.OpenSslServerContext) ArrayList(java.util.ArrayList) SslContext(io.netty.handler.ssl.SslContext) Parameters(org.junit.runners.Parameterized.Parameters)

Aggregations

OpenSslServerContext (io.netty.handler.ssl.OpenSslServerContext)2 SslContext (io.netty.handler.ssl.SslContext)2 JdkSslClientContext (io.netty.handler.ssl.JdkSslClientContext)1 OpenSslServerSessionContext (io.netty.handler.ssl.OpenSslServerSessionContext)1 HttpServerOptions (io.vertx.core.http.HttpServerOptions)1 OpenSSLEngineOptions (io.vertx.core.net.OpenSSLEngineOptions)1 SSLHelper (io.vertx.core.net.impl.SSLHelper)1 ArrayList (java.util.ArrayList)1 SSLSessionContext (javax.net.ssl.SSLSessionContext)1 Parameters (org.junit.runners.Parameterized.Parameters)1