hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyrus Adkisson <cyrus7...@gmail.com>
Subject Re: httpcore + ssl... is NIO the only way?
Date Mon, 14 Jan 2013 20:19:26 GMT
Very much so. Thank you

On Mon, Jan 14, 2013 at 3:11 PM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Mon, 2013-01-14 at 13:50 -0500, Cyrus Adkisson wrote:
> > I'm currently using httpcore to access the Twitter api. It's been a
> > life-saver since Twitter needs RFC 3986 encoding and HttpClient defaults
> to
> > (and seems difficult to un-default from) a lower URL encoding (17xx,
> can't
> > remember exactly).
> >
>
> As of version 4.3 HttpClient will also execute requests with
> non-standard request URIs, if that helps.
>
> > Everything is working perfectly at the moment with http, but I really
> > should be using https. Looking around for an example of HTTPS with
> > httpcore, all I could find were some examples using the NIO package.
> >
> > Is NIO the only (or simplest) way to form SSL requests with httpcore?
> >
>
> Absolutely not. Blocking HTTP connections can be bound to any arbitrary
> socket (plain or SSL)
>
> ---
> SSLContext sslcontext = SSLContext.getInstance("TLS");
> sslcontext.init(null, null, null);
> SSLSocketFactory ssf = sslcontext.getSocketFactory();
> Socket socket = ssf.createSocket();
> socket.connect(
>   new InetSocketAddress(host.getHostName(), host.getPort()), 0);
> conn.bind(socket);
> ---
>
> Hope this helps
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message