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 Answers1

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)

Alican Beydemir
  • 343
  • 2
  • 13
  • 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 – John Dabsky Aug 05 '18 at 00:49
  • 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 https://netty.io/4.1/api/io/netty/handler/codec/http/HttpObjectAggregator.html https://netty.io/4.1/api/io/netty/handler/ssl/SslHandler.html https://netty.io/4.1/api/io/netty/handler/proxy/HttpProxyHandler.html – Alican Beydemir Aug 05 '18 at 11:04