Android HttpClient and HTTPS

后端 未结 1 1257
独厮守ぢ
独厮守ぢ 2020-12-01 00:06

I\'m new to implementing HTTPS connections in Android. Essentially, I\'m trying to connect to a server using the org.apache.http.client.HttpClient. I believe, at some poin

相关标签:
1条回答
  • 2020-12-01 00:47

    This should get you started. I'm using basically the same, except with ThreadSafeClientConnManager.

    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("https", 
                SSLSocketFactory.getSocketFactory(), 443));
    
    HttpParams params = new BasicHttpParams();
    
    SingleClientConnManager mgr = new SingleClientConnManager(params, schemeRegistry);
    
    HttpClient client = new DefaultHttpClient(mgr, params);
    
    0 讨论(0)
提交回复
热议问题