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: [email protected]
For additional commands, e-mail: [email protected]