2013-03-13 50 views
0

我正在使用我們的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 

讓我知道你是否可以提供幫助。

感謝

回答

0

你必須遵循你跟着上的瀏覽器客戶端

這是你的客戶端您可以添加以下代碼

$ atmosphere.subscribe相同的規則(請求);

您也必須對您的java客戶端進行相同的操作,由於您的請求沒有訂閱大氣,所以氣氛不能認證您的請求。在Java端首先你要做的氣氛連接,然後你不得不解僱你的請求......

0

最可能的原因是你可能沒有客戶端的URL沒有「的WebSocket」,如:

「WS ://「+ HOST +」:「+ PORT +」/ websocket「

如果您在與服務器交談時錯過/ websocket客戶端代碼,您將得到此異常