Example usage for io.netty.handler.ssl SslContext sessionContext

List of usage examples for io.netty.handler.ssl SslContext sessionContext

Introduction

In this page you can find the example usage for io.netty.handler.ssl SslContext sessionContext.

Prototype

public abstract SSLSessionContext sessionContext();

Source Link

Document

Returns the SSLSessionContext object held by this context.

Usage

From source file:io.vertx.core.net.SSLHelperTest.java

License:Open Source License

private void testOpenSslServerSessionContext(boolean testDefault) {
    HttpServerOptions httpServerOptions = new HttpServerOptions()
            .setOpenSslEngineOptions(new OpenSSLEngineOptions());

    if (!testDefault) {
        httpServerOptions.setOpenSslEngineOptions(new OpenSSLEngineOptions().setSessionCacheEnabled(false));
    }//  w  ww . java2  s  . co  m

    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());
    }
}