private SSLEngine createSSLEngine() throws UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException
    {
        final SSLContext sslContext = getSSLContext();

        final SSLEngine sslEngine = sslContext.createSSLEngine();

        // Configure protocol support.
        final Set<String> protocols = new HashSet<>(configuration.getEncryptionProtocols());
        protocols.remove("TLSv1.3"); // TLSv1.3 is not compatible with this SSLEngine implementation
        if ( !protocols.isEmpty() )
        {
            // When an explicit list of enabled protocols is defined, use only those (otherwise, an implementation-specific default will be used).
            sslEngine.setEnabledProtocols( protocols.toArray( new String[ protocols.size() ] ) );
        }

        // Configure cipher suite support.
        final Set<String> cipherSuites = configuration.getEncryptionCipherSuites();
        if ( !cipherSuites.isEmpty() )
        {
            // When an explicit list of enabled protocols is defined, use only those (otherwise, an implementation-specific default will be used)..
            sslEngine.setEnabledCipherSuites( cipherSuites.toArray( new String[ cipherSuites.size() ] ) );
        }

        return sslEngine;
    }
A utility method that implements the shared functionality of getClientModeSSLEngine and getServerModeSSLEngine.

This method is used to initialize and pre-configure an instance of SSLEngine for a particular connection type.
The returned value lacks further configuration. In most cases, developers will want to use getClientModeSSLEngine
or getServerModeSSLEngine instead of this method.

@return A new pre-configured SSLEngine instance (never null).
xmppserver/src/main/java/org/jivesoftware/openfire/spi/EncryptionArtifactFactory.java