String className = SSLServerSocketFactoryServiceMBean.class.getName();
boolean isCorrectType = SecurityUtility.isInstanceOf(server, serverSocketFactoryObjName, className);
if (isCorrectType)
{
Object o = SecurityUtility.getMBeanAttribute(server, serverSocketFactoryObjName, "SSLSocketBuilder");
SSLSocketBuilderMBean sslSocketBuilder = (SSLSocketBuilderMBean) o;
if (sslSocketBuilder != null)
{
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);