private TTransport createUnderlyingTransport() throws TTransportException, SQLException {
    int maxMessageSize = getMaxMessageSize();
    TTransport transport = null;
    // Note: Thrift returns an SSL socket that is already bound to the specified host:port
    // Therefore an open called on this would be a no-op later
    // Hence, any TTransportException related to connecting with the peer are thrown here.
    // Bubbling them up the call hierarchy so that a retry can happen in openTransport,
    // if dynamic service discovery is configured.
    if (isSslConnection()) {
      // get SSL socket
      String sslTrustStore = sessConfMap.get(JdbcConnectionParams.SSL_TRUST_STORE);
      String sslTrustStorePassword = Utils.getPassword(sessConfMap, JdbcConnectionParams.SSL_TRUST_STORE_PASSWORD);

      if (sslTrustStore == null || sslTrustStore.isEmpty()) {
        transport = HiveAuthUtils.getSSLSocket(host, port, loginTimeout, maxMessageSize);
      } else {
        String trustStoreType =
                sessConfMap.get(JdbcConnectionParams.SSL_TRUST_STORE_TYPE);
        if (trustStoreType == null) {
          trustStoreType = "";
        }
        String trustStoreAlgorithm =
                sessConfMap.get(JdbcConnectionParams.SSL_TRUST_MANAGER_FACTORY_ALGORITHM);
        if (trustStoreAlgorithm == null) {
          trustStoreAlgorithm = "";
        }
        transport = HiveAuthUtils.getSSLSocket(host, port, loginTimeout, sslTrustStore, sslTrustStorePassword,
            trustStoreType, trustStoreAlgorithm, maxMessageSize);
      }
    } else {
      // get non-SSL socket transport
      transport = HiveAuthUtils.getSocketTransport(host, port, loginTimeout, maxMessageSize);
    }
    return transport;
  }
Create underlying SSL or non-SSL transport

@return TTransport
@throws TTransportException
@throws SQLException
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java