public void handleMessage(final Message message) throws Fault { if (!locator.isEnabled()) { return; } final Conduit conduit = message.getExchange().getConduit(message); if (!(conduit instanceof HTTPConduit)) { // SSL config only applies to HTTPConduit, early-out. return; } final HTTPConduit httpConduit = (HTTPConduit) conduit; final String endpoint = (String) message.get(Message.ENDPOINT_ADDRESS); if (endpoint == null) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("Null endpoint address encountered, unable to appy SSL configuration"); } return; } try { final URL endpointUrl = new URL(endpoint); if (supports(endpointUrl)) { final TLSClientParameters tlsClientParameters = getOrCreateAndSetTLSClientParameters(httpConduit); tlsClientParameters.setSSLSocketFactory(locator.getSSLFactory(sslAlias, endpointUrl)); } } catch (final Exception exception) { if (LOGGER.isErrorEnabled()) { LOGGER.error( "Got an exception getting the Websphere SSL Socket Factory: '{}'.", exception.getMessage()); } throw new Fault(exception); } }
// Relaxed visibility for testing WebSphereSSLSocketFactoryLocator createLocator() { return WebSphereSSLSocketFactoryLocator.getInstance(); }