private static TSocket getSSLSocketWithHttps(TSocket tSSLSocket, int maxMessageSize)
      throws TTransportException {
    SSLSocket sslSocket = (SSLSocket) tSSLSocket.getSocket();
    SSLParameters sslParams = sslSocket.getSSLParameters();
    if (IPStackUtils.isActiveStackLoopbackIP(sslSocket.getLocalAddress().getHostAddress())) {
      sslParams.setEndpointIdentificationAlgorithm(null);
    } else {
      sslParams.setEndpointIdentificationAlgorithm("HTTPS");
    }
    sslSocket.setSSLParameters(sslParams);
    TSocket tSocket = new TSocket(sslSocket);
    return configureThriftMaxMessageSize(tSocket, maxMessageSize);
  }
Create a TSocket for the provided host and port with specified loginTimeout and maxMessageSize.
will default to Thrift library default.
@param host Host to connect to.
@param port Port to connect to.
@param loginTimeout Socket timeout (0 means no timeout).
@param maxMessageSize Size in bytes for max allowable Thrift message size, less than or equal to 0
                      results in using the Thrift library default.
@return TTransport TSocket for host/port
common/src/java/org/apache/hadoop/hive/common/auth/HiveAuthUtils.java