code: protected SSLSocketFactory createSSLSocketFactoryWithTrustManagers(TrustManager[] trustManagers) throws KeystoreException {
  
  		logger.debug("Creating SSLSocketFactory");
  		// Get a KeyManager and initialize it 
  		try {
  			KeyStore keystore = getKeystore();
  			KeyManagerFactory kmf = KeyManagerFactory.getInstance(ALGORITHM);
  			try {
  				char[] password = KeystoreManager.getKeystorePasswordForSSL(server);
  				kmf.init(keystore, password);
  			} catch (Exception e) {
  				e = KeystoreManager.wrapKeystoreException(e);
  				throw e;
  			}
  
  			// Get the SSLContext to help create SSLSocketFactory			
  			SSLContext sslc = SSLContext.getInstance(PROTOCOL);
  			sslc.init(kmf.getKeyManagers(), trustManagers, null);
  
  			return sslc.getSocketFactory();
  		} catch (Exception e) {
  			throw new KeystoreException("Keystore exception: " + e.getMessage(), e);
  		}
  	}
docs: Generic SSLSocketFactory builder
  
  @param trustManagers
  @return SSLSocketFactory
  @throws KeystoreException