我试图在重定向中调用包含url和https协议的url时遇到一般SSLEngine问题。
我正在使用HttpAsyncClient版本4.1
例如为: 主网址https://example.com重定向到https://example.net
在HTTP的情况下正常工作。
我尝试使用:
TrustStrategy acceptingTrustStrategy = new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] certificate, String authType) {
return true;
}
};
SSLContext sslContext = null;
try {
sslContext = SSLContexts.custom().useTLS().loadTrustMaterial(null, acceptingTrustStrategy).build();
} catch (Exception e) {
// Handle error
}
CloseableHttpAsyncClient httpClient =
HttpAsyncClientBuilder.create().setConnectionManager(connManager)
.setDefaultRequestConfig(HttpClientUtils.configForClient)
.setHostnameVerifier(SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER)
.setSSLContext(sslContext).setRedirectStrategy(LaxRedirectStrategy.INSTANCE).build();