@Override
  public Socket createSocket(String host, int port) throws IOException {
    SocketCreator socketCreator;

    try {
      socketCreator =
          SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX);
      return socketCreator.forClient().connect(new HostAndPort(host, port), 0);
    } catch (Exception exception) {
      try {
        // In gfsh the ssl config is stored within the GEODE_SSL_CONFIG_PROPERTIES system property.
        // See the constructor for JMXOperationInvoker.
        Properties gfProperties = new Properties();
        gfProperties.load(new StringReader(System.getProperty(GEODE_SSL_CONFIG_PROPERTIES)));
        SSLConfig sslConfig = SSLConfigurationFactory
            .getSSLConfigForComponent(gfProperties, SecurableCommunicationChannel.JMX);
        socketCreator = new SocketCreator(sslConfig);
        return socketCreator.forClient().connect(new HostAndPort(host, port), 0);
      } catch (Exception finalException) {
        // Back off and use the default factory (javax.net.ssl properties are used to configure
        // SSL).
        return defaultFactory.createSocket(host, port);
      }
    }
  }
What's going on here? For jar deployment we're using the RMI-IO library which uses RMI to
allow streaming files. When using SSL with RMI, the weird thing is that the
RMIClientSocketFactory is defined on the server where the relevant object is being exported.
This factory is serialized to the client to be used when making calls back to the server. Thus
the factory needs to be able to create sockets configured according to the remote configuration.
geode-core/src/main/java/org/apache/geode/management/internal/ContextAwareSSLRMIClientSocketFactory.java