use of com.alibaba.nacos.common.tls.SelfHostnameVerifier in project nacos by alibaba.
the class AbstractHttpClientFactory method initTls.
protected void initTls(BiConsumer<SSLContext, HostnameVerifier> initTlsBiFunc, TlsFileWatcher.FileChangeListener tlsChangeListener) {
if (!TlsSystemConfig.tlsEnable) {
return;
}
final HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier();
final SelfHostnameVerifier selfHostnameVerifier = new SelfHostnameVerifier(hv);
initTlsBiFunc.accept(loadSSLContext(), selfHostnameVerifier);
if (tlsChangeListener != null) {
try {
TlsFileWatcher.getInstance().addFileChangeListener(tlsChangeListener, TlsSystemConfig.tlsClientTrustCertPath, TlsSystemConfig.tlsClientKeyPath);
} catch (IOException e) {
assignLogger().error("add tls file listener fail", e);
}
}
}
Aggregations