How can I get the underlying Socket from an httpclient connection?
<p>This question is worded the same way as another question on SO (<a href="https://stackoverflow.com/questions/3741417/httpclient-how-do-i-obtain-the-underlying-socket-from-an-existing-connection">HttpClient: how do I obtain the underlying socket from an existing connection?</a>), but that question is actually about tunneling other protocols through HTTP(S) and thus the answer is quite a bit different.</p>
<p>What I'm trying to do is make an HTTPS connection, then find out the details of that connection. Java's <code>SSLSocket</code> class will give me what I need, but I need to be able to get a hold of the <code>Socket</code> itself in order to interrogate it.</p>
<p>Is there a way to get to the underlying <code>Socket</code>? httpclient/httpcore has become a maze of factories and private/protected implementations of things, so it's really difficult to poke-around the API to figure out how to actually get things once they have been configured.</p>