简体   繁体   English

Websocket客户端无法在applet中工作

[英]Websocket client doesn't work from applet

I'm using Ning http library to connect to websocket server(Weblogic 12.1.2) using this code: 我正在使用Ning http库使用以下代码连接到websocket服务器(Weblogic 12.1.2):

WebSocket ws = new AsyncHttpClient().prepareGet(uri.toASCIIString()).execute(new WebSocketUpgradeHandler.Builder().build()).get();
ws.addWebSocketListener(this);
ws.sendTextMessage(message);

It works fine when running in the JUnit test. 在JUnit测试中运行时,它工作正常。 But when I run exactly the same code from the applet(on same PC), I get this exception: 但是,当我从小程序(在同一台PC上)运行完全相同的代码时,出现此异常:

java.util.concurrent.ExecutionException: java.io.IOException: Invalid handshake response
at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:324)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.abort(NettyAsyncHttpProvider.java:1320)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.access$800(NettyAsyncHttpProvider.java:155)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider$WebSocketProtocol.handle(NettyAsyncHttpProvider.java:2312)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.messageReceived(NettyAsyncHttpProvider.java:1142)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)

What can be the cause? 可能是什么原因? From the wireshark I see the WebSocket version is 13 in both cases. 从wireshark中,我看到两种情况下的WebSocket版本都是13。 I don't use secured ws. 我不使用安全的ws。

我正在运行完全相同的代码,但是URI不同,因此它与服务器上的模式不匹配:(一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM