} else if (consumer.getConfiguration().getSslContextParameters() != null) {
SSLContext context = consumer.getConfiguration().getSslContextParameters().createSSLContext();
SSLEngine engine = context.createSSLEngine();
engine.setUseClientMode(false);
engine.setNeedClientAuth(consumer.getConfiguration().isNeedClientAuth());
return new SslHandler(engine);
} else {
SSLEngineFactory sslEngineFactory = new SSLEngineFactory(
consumer.getConfiguration().getKeyStoreFormat(),
consumer.getConfiguration().getSecurityProvider(),
consumer.getConfiguration().getKeyStoreFile(),
consumer.getConfiguration().getTrustStoreFile(),
consumer.getConfiguration().getPassphrase().toCharArray());
SSLEngine sslEngine = sslEngineFactory.createServerSSLEngine();
sslEngine.setUseClientMode(false);
sslEngine.setNeedClientAuth(consumer.getConfiguration().isNeedClientAuth());
return new SslHandler(sslEngine);
}
}