【问题标题】:WebSockets (wss) and Proxy Server with AsyncHttpClientWebSockets (wss) 和带有 AsyncHttpClient 的代理服务器
【发布时间】:2012-08-06 02:52:49
【问题描述】:

我正在尝试使用带有代理服务器配置的 AsyncHttpClient 来使用 wss 进行连接,但我没有运气。我一直在使用 async-http-client 1.7.5 和 grizzly-websockets 2.2.13 我的第一次尝试

AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()
        .setSSLContext(sc)
        .setProxyServer(
        new ProxyServer(Protocol.HTTP, "192.168.1.130", 3128))
        .build();
NettyWebSocket w = (NettyWebSocket)c.prepareGet("wss://192.168.1.124/atmosphere-chat/chat")
        .execute(handler).get();

使用默认的 netty 配置无法正常工作,这种尝试似乎至少要通过代理并连接到远程服务器。我得到的例外是

java.lang.IllegalArgumentException: unsupported message type: class org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

当我通过

切换到使用 grizzly
AsyncHttpClient c = new AsyncHttpClient(new GrizzlyAsyncHttpProvider(config), config);

事情变得更好/更糟。在这种情况下,grizzly 似乎无法通过 http 代理发送连接动词,并立即开始通过 ssl 进行通信,但失败了。我认为这将是一个得到很好支持的情况,因为在使用 SSL 时 websocket 连接将通过代理工作的可能性增加。 ]

Exception in thread "main" java.util.concurrent.ExecutionException: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

我是否超出了应该工作的范围?

【问题讨论】:

  • 你用的是哪个版本的netty?
  • 3.4.4.final,这是通过 async-http-client 1.7.5 引入的

标签: websocket netty grizzly asynchttpclient


【解决方案1】:

原来这是 AHC (https://github.com/sonatype/async-http-client/issues/131#issuecomment-7745037) 中的一个错误,该错误在 1.8.0 中得到修复。

【讨论】:

    猜你喜欢
    • 2022-01-08
    • 1970-01-01
    • 1970-01-01
    • 2018-07-24
    • 2016-10-03
    • 2023-03-05
    • 2017-11-08
    • 2019-01-08
    • 1970-01-01
    相关资源
    最近更新 更多