Map<String,TransportClient> newTransportClients = new HashMap<String, TransportClient>();
if (schemes != null && !schemes.isEmpty())
{
for (String scheme : schemes)
{
TransportClientFactory factory = _clientFactories.get(scheme);
if ("https".equals(scheme))
{
if (_isSSLEnabled)
{
// if https is a prioritized scheme and SSL is enabled, then a SSLContext and SSLParameters
// should have been passed in during creation.
if (_sslContext != null && _sslParameters != null)
{
transportClientProperties.put(HttpClientFactory.HTTP_SSL_CONTEXT, _sslContext);
transportClientProperties.put(HttpClientFactory.HTTP_SSL_PARAMS, _sslParameters);
}
else
{
_log.error("https specified as a prioritized scheme for service: " + serviceProperties.getServiceName() +
" but no SSLContext or SSLParameters have been configured.");
throw new IllegalStateException("SSL enabled but required SSLContext and SSLParameters" +
"were not both present.");
}
}
else
{
// don't create this transport client if ssl isn't enabled. If the https transport client
// is requested later on, getTrackerClient will catch this situation and log an error.
continue;
}
}
if (factory != null)
{
transportClientProperties.put(HttpClientFactory.HTTP_SERVICE_NAME, serviceProperties.getServiceName());
TransportClient client = factory.getClient(transportClientProperties);
newTransportClients.put(scheme.toLowerCase(), client);
}
else
{
_log.warn("Failed to find client factory for scheme {}", scheme);