return producer.getConfiguration().getSslHandler();
} else if (producer.getConfiguration().getSslContextParameters() != null) {
SSLContext context = producer.getConfiguration().getSslContextParameters().createSSLContext();
SSLEngine engine = context.createSSLEngine();
engine.setUseClientMode(true);
return new SslHandler(engine);
} else {
if (producer.getConfiguration().getKeyStoreFile() == null) {
LOG.debug("keystorefile is null");
}
if (producer.getConfiguration().getTrustStoreFile() == null) {
LOG.debug("truststorefile is null");
}
if (producer.getConfiguration().getPassphrase().toCharArray() == null) {
LOG.debug("passphrase is null");
}
SSLEngineFactory sslEngineFactory = new SSLEngineFactory(
producer.getConfiguration().getKeyStoreFormat(),
producer.getConfiguration().getSecurityProvider(),
producer.getConfiguration().getKeyStoreFile(),
producer.getConfiguration().getTrustStoreFile(),
producer.getConfiguration().getPassphrase().toCharArray());
SSLEngine sslEngine = sslEngineFactory.createClientSSLEngine();
return new SslHandler(sslEngine);
}
}