how to use Socks4/5 Proxy Handlers in Netty Client (4.1)

纵饮孤独 提交于 2019-12-04 02:28:45

The proxy instance should be the first in the pipeline, as you want it to handle the connection to the proxy first, before any http contents are handled.

To change this, change p.addLast(new Socks4ProxyHandler(new InetSocketAddress("149.202.68.167", 37678))); to:

p.addFirst(new Socks4ProxyHandler(new InetSocketAddress("149.202.68.167", 37678)));

As explained in the documentation for ChannelPipeline, the flow of the data is starting at the first handler, and ending at the last handler.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!