java - HttpClient 4.3.x, fixing deprecated code to use current HttpClient implementations -
I had the following code, which is still compiled, but they all dislike:
SSLSocketFactory sslSocketFactory = New SSLSocketFactory (Reference, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); ClientConconditionManitorConnectConcertManager = base.getConnectionManager (); Schemersystems Scheméragriti = ClientConcationManager.GetSymeMyArigesty (); schemeRegistry.register (new plan ("https", 443, sslSocketFactory)); Return the new DefaultHttpClient (clientConnectionManager, base.getParams ()); I tried my best to replace it with this part of the code:
http clientbuilder builder = http clientbuilder.credit (); SSLConnectionSocketFactory sslConnectionFactory = New SSLConnectionSocketFactory (Reference, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); Builder.setConnectionManager (new BasicHttpClientConnectionManager ()); Builder.setSSLSocketFactory (sslConnectionFactory); Return maker Build ();
As you can see, there are some lines of code from the top post, which I do not know how to get involved in the new part. I need a
SchemeRegistry ?
How to add the necessary code as,http clientbuilder builder = http clientbuilder Create (); SSLConnectionSocketFactory sslConnectionFactory = New SSLConnectionSocketFactory (Reference, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); Builder.setSSLSocketFactory (sslConnectionFactory); The & lt; ConnectionSocketFactory & gt; Registry = Registry Builder & Lt; ConnectionSocketFactory & gt; Create (). Registrar ("https", sslConnectionFactory) .build (); HttpClientConnectionManager ccm = New BasicHttpClientConnectionManager (Registry); Builder.setConnectionManager (CCM); Return maker Build ();
Comments
Post a Comment