SSLEngine engine = sslContext.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);
}
}