Why can't help to see me this configuration, visit HTTPS interface
The static {
ConnectionSocketFactory plainsf=PlainConnectionSocketFactory. GetSocketFactory ();
SSLContext sc;
Try {
Sc=SSLContext. GetInstance (" TLS ");
TrustManager trustAllCerts=new TrustManager [] [] {new X509TrustManager () {
@ Override
Public void checkClientTrusted (X509Certificate [] x509Certificates, String s) throws CertificateException {
}
@ Override
Public void checkServerTrusted (X509Certificate [] x509Certificates, String s) throws CertificateException {
}
@ Override
Public X509Certificate [] getAcceptedIssuers () {
return null;
}
}};
Sc. Init (null, trustAllCerts, null);
} the catch (Exception e) {
The LOG. The error (" some thing happen ", e);
Throw new ServiceException (e);
}
ConnectionSocketFactory SSLSF=new SSLConnectionSocketFactory (sc, (s, sslSession) - & gt; True);
ConnectionKeepAliveStrategy ConnectionKeepAliveStrategy=(httpResponse httpContext) - & gt; {
The return of 20 l * 1000;
};
Registry
Registry=RegistryBuilder. & lt; ConnectionSocketFactory> Create ()
Register (" HTTP ", plainsf). Register (" FTP ", plainsf). Register (" HTTPS, "SSLSF). The build ();
PoolingHttpClientConnectionManager connManager=new PoolingHttpClientConnectionManager (registry);
ConnManager. SetMaxTotal (400);
ConnManager. SetDefaultMaxPerRoute (200);
RequestConfig RequestConfig=RequestConfig. Custom (.) setConnectTimeout (HTTP_CONNECT_TIME_OUT)
SetConnectionRequestTimeout (3000). SetSocketTimeout (HTTP_TIME_OUT). The build ();
The client=HttpClients. Custom (.) setConnectionManager (connManager)
SetRetryHandler (new DefaultHttpRequestRetryHandler ()). SetDefaultRequestConfig (requestConfig)
SetKeepAliveStrategy (connectionKeepAliveStrategy). The build ();
} CodePudding user response:
Baidu is so worthy, to I this not line, finally returned to the client object should be able to access the HTTPS interface on principle CodePudding user response:
What is the error information? CodePudding user response: