SSLSocketBuilder clonedSSLSocketBuilder = (SSLSocketBuilder) sslSocketBuilder.clone();
boolean shouldUseDefault = sslSocketBuilder.getUseSSLServerSocketFactory();
clonedSSLSocketBuilder.setUseSSLSocketFactory(shouldUseDefault);
boolean useClientMode = sslSocketBuilder.isServerSocketUseClientMode();
clonedSSLSocketBuilder.setSocketUseClientMode(useClientMode);
SSLSocketFactoryService sslSocketFactoryService = new SSLSocketFactoryService();
sslSocketFactoryService.setSSLSocketBuilder(clonedSSLSocketBuilder);
sslSocketFactoryService.start();
clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, sslSocketFactoryService);
clientConfig.put(SSLSocketBuilder.REMOTING_SOCKET_USE_CLIENT_MODE, "false");
// JBREM-536
clientConfig.put("hostnameVerifier", "org.jboss.test.remoting.transport.http.ssl.config.SelfIdentifyingHostnameVerifier");
serverInvoker.setSocketFactory(sslSocketFactoryService);