On Sun, 2010-05-30 at 21:46 +0000, Lee Breisacher wrote:
> Yes, I read that piece of the tutorial, but I have a bare-bones simple client:
> 
> HttpClient httpclient = new DefaultHttpClient();
> HttpGet httpget = new HttpGet("https://www.xyz.com/...";);
> HttpResponse response = httpclient.execute(httpget);
> HttpEntity entity = response.getEntity();
> 
> From the tutorial, it looks like there's no easy way to adjust hostname 
> verification. I must get into details of socket factories and params and 
> sf.connectSocket() and such? It's not obvious how all these pieces fit 
> together.
> 
> Lee
> 

SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, null, null);
SSLSocketFactory sf = new SSLSocketFactory(sslcontext);
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);

DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getConnectionManager().getSchemeRegistry().register(
  new Scheme("https", sf, 443));

Hope this helps

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to