public SslContext createServerModeSslContext(boolean directTLS) throws UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, SSLException {
        SslContextBuilder builder = SslContextBuilder.forServer(getKeyManagerFactory());

        // Set policy for checking client certificates.
        switch ( configuration.getClientAuth() )
        {
            case disabled:
                builder.clientAuth(ClientAuth.NONE);
                break;
            case wanted:
                builder.clientAuth(ClientAuth.OPTIONAL);
                break;
            case needed:
                builder.clientAuth(ClientAuth.REQUIRE);
                break;
        }

        builder.trustManager(getTrustManagers()[0]); // The existing implementation never returns more than one trust manager.
        builder.protocols(configuration.getEncryptionProtocols());
        builder.ciphers(configuration.getEncryptionCipherSuites());
        builder.startTls(!directTLS);

        return builder.build();
    }
Create and configure a new SslContext instance for a Netty server.<p>

@param directTLS if the first write request should be encrypted.
@return A secure socket protocol implementation which acts as a factory for {@link SSLContext} and {@link io.netty.handler.ssl.SslHandler}
xmppserver/src/main/java/org/jivesoftware/openfire/spi/EncryptionArtifactFactory.java