Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set custom socket implementation in HttpUrlConnection

Looking for java networking experts here :)

The team that I'm part of is developing a solution which consists of server part and a small client API (and api-impl) bundle that our customers must deploy and use in order to make http requests to the server part.

One of our customers who uses the API is asking us to provide him with a new method for setting a custom Socket implementation, so that the actual http communication with the server part can go through his Socket. Until now, we used HttpsUrlConnection to connect to the server part. The question is - is it possible to somehow supply the HttpsUrlConnection with a custom socket implementation instead of the default one? What are the alternatives? Is Apache HttpClient able to do this?

like image 772
mdzh Avatar asked Aug 02 '14 12:08

mdzh


1 Answers

It is possible to set an SSLSocketFactory on an HttpsUrlConnection. This is only possible with ssl and not with the "plain" HttpUrlConnection.

like image 90
Brett Okken Avatar answered Oct 18 '22 08:10

Brett Okken