password = commandLineArgs.get(CommandLineInterpreter.OPTION_KEYPASS);
keystorePath = commandLineArgs.get(CommandLineInterpreter.OPTION_KEYSTORE);
}
final SslContextFactory sslContextFactory = constructSslContextFactory(password, keystorePath);
final SslSocketConnector sslConnector = new SslSocketConnector(sslContextFactory);
sslConnector.setPort(getStubsSslPort(commandLineArgs));
sslConnector.setName(SSL_CONNECTOR_NAME);
sslConnector.setHost(DEFAULT_HOST);
if (commandLineArgs.containsKey(CommandLineInterpreter.OPTION_ADDRESS)) {
sslConnector.setHost(commandLineArgs.get(CommandLineInterpreter.OPTION_ADDRESS));
}
final String status = String.format("Stubs portal configured with TLS at https://%s:%s using %s keystore",
sslConnector.getHost(), sslConnector.getPort(), (ObjectUtils.isNull(keystorePath) ? "internal" : "provided " + keystorePath));
ANSITerminal.status(status);
currentStubsSslPort = sslConnector.getPort();
return sslConnector;
}