0

I've been working on a Java project for some time and I've had a LOT of troubles with HTTP requests. My project works by sending requests, with different types of proxies. Currently I'm using OkHttp but it doesn't support SSL proxies natively and has some issues with SOCKS.

With OkHttp and SOCKS I get some exceptions like Malformed reply from SOCKS server.

My question is: is there a good Java HTTP library that supports HTTP/HTTPS/SOCKS proxies?

1 Answer 1

1

You can use AsyncHttpClient library or it's core library Netty, i recommend netty for specific development cases

Example usage for AsyncHttpClient http://www.baeldung.com/async-http-client just fill the proxy server parameters

Example netty usage is more understandable just change the Class type of proxy in the answer how to use Socks4/5 Proxy Handlers in Netty Client (4.1)

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! I'm using that now. By the way, does it support HTTPS proxifes? In ProxyType I only see HTTP, SOCKS_V4 and SOCKS_V5
As I know HTTP is a generic type for both HTTP/HTTPS proxies, in netty if your forward proxy forces you to use ssl ( i mean HTTPS) there is a SSL handler Class just like proxy Handler, actually, there is an abstract class form named handler in netty that you can add it to your pipeline to solve various things protocol encoding/decoding, proxying , SSL etc netty.io/4.1/api/io/netty/handler/codec/http/… netty.io/4.1/api/io/netty/handler/ssl/SslHandler.html netty.io/4.1/api/io/netty/handler/proxy/HttpProxyHandler.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.