in kyuubi-relocated-hive-metastore-client/src/main/java/org/apache/kyuubi/shaded/hive/metastore/utils/SecurityUtils.java [274:298]
public static TTransport getSSLSocket(
String host,
int port,
int socketTimeout,
int connectionTimeout,
String trustStorePath,
String trustStorePassWord,
String trustStoreType,
String trustStoreAlgorithm)
throws TTransportException {
TSSLTransportFactory.TSSLTransportParameters params =
new TSSLTransportFactory.TSSLTransportParameters();
String tStoreType = trustStoreType.isEmpty() ? KeyStore.getDefaultType() : trustStoreType;
String tStoreAlgorithm =
trustStoreAlgorithm.isEmpty()
? TrustManagerFactory.getDefaultAlgorithm()
: trustStoreAlgorithm;
params.setTrustStore(trustStorePath, trustStorePassWord, tStoreAlgorithm, tStoreType);
params.requireClientAuth(true);
// The underlying SSLSocket object is bound to host:port with the given SO_TIMEOUT and
// connection timeout and SSLContext created with the given params
TSocket tSSLSocket = TSSLTransportFactory.getClientSocket(host, port, socketTimeout, params);
tSSLSocket.setConnectTimeout(connectionTimeout);
return getSSLSocketWithHttps(tSSLSocket);
}