websocket 无效握手响应异常

hsgswve4  于 2023-04-06  发布在  其他
关注(0)|答案(3)|浏览(432)

我正在用我们的tomcat服务器做压力测试,它通过WebSocket技术与客户端通信。所以当我在客户端尝试超过150个并发用户时,我收到了这个异常,我不知道服务器想说什么。

java.util.concurrent.ExecutionException: java.io.IOException: Invalid handshake response
    at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:297)
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.abort(NettyAsyncHttpProvider.java:1376)
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.access$800(NettyAsyncHttpProvider.java:137)
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider$WebSocketProtocol.handle(NettyAsyncHttpProvider.java:2400)
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.messageReceived(NettyAsyncHttpProvider.java:1178)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:792)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndFireMessageReceived(ReplayingDecoder.java:600)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:584)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:445)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:372)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:246)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:38)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.IOException: Invalid handshake response
    ... 23 more

如果你能帮忙就告诉我。
谢谢

eqfvzcg8

eqfvzcg81#

最可能的原因是你可能没有客户端URL没有“WebSocket”像:
“ws://"+HOST+":“+ PORT+"/WebSocket”
如果在与服务器通信时在客户端代码中遗漏了/WebSocket,则会出现此异常

ijnw1ujt

ijnw1ujt2#

您必须遵循与浏览器客户端相同的规则
在你的客户端,你可以添加下面的代码
$mysql. println();
同样的你必须做你的java客户端也,因为你的请求没有订阅大气,大气是不authenate你的请求.在java端首先你做大气连接,然后你必须发射你的请求...

5vf7fwbs

5vf7fwbs3#

我也面临着同样的问题,解决了把 chrome driver.exe文件在其他一些location.it工作.

  • 配置驱动程序= {类型:'chromedriver',可执行文件:'C:\driver\chromedriver_win32\chromedriver.exe' }

相关问题