I had a similar problem with HttpClient
version 4.
I couldn't connect to the server because of a SOCKS proxy error and I fixed it using the below configuration:
client.getParams().setParameter("socksProxyHost",proxyHost);
client.getParams().setParameter("socksProxyPort",proxyPort);