I am on a Windows machine at work and am using HttpClient to make a request
via a web proxy. But the problem is that I keep 407 Authentication required
message.

But if I do the same thing via the RestTemplate of Spring, which uses the
vanilla java.net.URLConnection class, with supplying just the proxy address
and port, it works fine. *It doesn't even need the user name and password
for authentication. *

Why does this work? Why does HttpClient fail?

Doing some digging into the source I made out that HttpClient first opens a
socket to the required address and then reads and writes from that socket.
AFAIK, java.net.URLConnection does not do that.

So my question is what does java.net.URLConnection do differently? What is
the difference between opening a socket.

Also how do I make HttpClient behave like  java.net.URLConnection so that I
can avoid the error.

Clearly  java.net.URLConnection  is doing something right.

Any help or suggestions ?

-- 
Regards,
Sreyan

Reply via email to