/** * Per spec, the physical connection must be failed. * <p> * <a href="https://tools.ietf.org/html/draft-ietf-hybi-websocket-multiplexing-08#section-18">Section 18. Fail the Physical Connection.</a> * * <blockquote> To _Fail the Physical Connection_, an endpoint MUST send a DropChannel multiplex control block with objective channel ID of 0 and drop * reason code in the range of 2000-2999, and then _Fail the WebSocket Connection_ on the physical connection with status code of 1011. </blockquote> */ private void mustFailPhysicalConnection(MuxPhysicalConnectionException muxe) { // TODO: stop muxer from receiving incoming sub-channel traffic. MuxDropChannel drop = muxe.getMuxDropChannel(); LOG.warn(muxe); try { generator.generate(null,drop); } catch (IOException ioe) { LOG.warn("Unable to send mux DropChannel",ioe); } String reason = "Mux[MUST FAIL]" + drop.getPhrase(); reason = StringUtil.truncate(reason,WebSocketFrame.MAX_CONTROL_PAYLOAD); this.physicalConnection.close(StatusCode.SERVER_ERROR,reason); // TODO: trigger abnormal close for all sub-channels. }
/** * Per spec, the physical connection must be failed. * <p> * <a href="https://tools.ietf.org/html/draft-ietf-hybi-websocket-multiplexing-08#section-18">Section 18. Fail the Physical Connection.</a> * * <blockquote> To _Fail the Physical Connection_, an endpoint MUST send a DropChannel multiplex control block with objective channel ID of 0 and drop * reason code in the range of 2000-2999, and then _Fail the WebSocket Connection_ on the physical connection with status code of 1011. </blockquote> */ private void mustFailPhysicalConnection(MuxPhysicalConnectionException muxe) { // TODO: stop muxer from receiving incoming sub-channel traffic. MuxDropChannel drop = muxe.getMuxDropChannel(); LOG.warn(muxe); try { generator.generate(null,drop); } catch (IOException ioe) { LOG.warn("Unable to send mux DropChannel",ioe); } String reason = "Mux[MUST FAIL]" + drop.getPhrase(); reason = StringUtil.truncate(reason,WebSocketFrame.MAX_CONTROL_PAYLOAD); this.physicalConnection.close(StatusCode.SERVER_ERROR,reason); // TODO: trigger abnormal close for all sub-channels. }