gpt4 book ai didi

java - 使用 netty 3.4.2.Final 通过代理工作

转载 作者:行者123 更新时间:2023-11-30 11:35:08 25 4
gpt4 key购买 nike

是否有可能使用此处描述的 Netty: http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

也许有一些选择,例如:

System.getProperties().put("socksProxySet","true");
System.getProperties().put("socksProxyHost","127.0.0.1");
System.getProperties().put("socksProxyPort","1080");

我试过了,但 netty 不接受属性,也不通过 socks 代理代理请求。

ChannelFuture future =
bootstrap.connect(
new InetSocketAddress(uri.getHost(), uri.getPort()));

我的 netty 客户端通过 websockets 连接到 netty 服务器。

Java NIO 不支持代理。 Netty 基于 Java NIO。我只是希望这种可能性存在/可以添加到 netty。

谢谢!

最佳答案

非常简单。您必须使用自己的处理程序创建您的监听器。示例可以在这里找到: https://github.com/shenfeng/async-http-client

类:

me.shenfeng.http.ConnectionListener
me.shenfeng.http.SocksHandler

来自 3.6.2.final 的 Netty 包含包 *.socks: http://netty.io/4.0/api/io/netty/handler/codec/socks/package-summary.html .
因此,该对象模型可用于编码/解码发送到/来自 socks 服务器的 socks 消息。

关于java - 使用 netty 3.4.2.Final 通过代理工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15269695/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com