The handshake handler should not handle the exception and simply close the socket. The exception should be propagated to the WebSocketServerProtocolHandler to send the appropriate response and then close the socket.

This commit is contained in:
Mike Heath 2012-11-19 23:11:23 -07:00 committed by Norman Maurer
parent 40e53b9b68
commit ff14feeb54

View File

@ -78,12 +78,6 @@ public class WebSocketServerProtocolHandshakeHandler extends ChannelInboundMessa
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
logger.error("Exception Caught", cause);
ctx.close();
}
private static void sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res) {
ChannelFuture f = ctx.channel().write(res);
if (!isKeepAlive(req) || res.getStatus().getCode() != 200) {