/** * Performs the closing handshake * * @param channel * Channel * @param frame * Closing Frame that was received */ public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) { if (channel == null) { throw new NullPointerException("channel"); } return close(channel, frame, channel.newPromise()); }
@Override public void closeWithPayload(ByteBuf byteBuf) { if (handshaker == null) { super.close(); } else { // make sure everything is flushed out on close endReadAndFlush(); // close the websocket connection by sending a close frame with specified payload. CloseWebSocketFrame closeFrame; if (byteBuf != null) { closeFrame = new CloseWebSocketFrame(true, 0, byteBuf); } else { closeFrame = new CloseWebSocketFrame(true, 0, 1000, null); } handshaker.close(chctx.channel(), closeFrame); } }
@Override public void closeWithPayload(ByteBuf byteBuf) { if (handshaker == null) { super.close(); } else { // make sure everything is flushed out on close endReadAndFlush(); // close the websocket connection by sending a close frame with specified payload. CloseWebSocketFrame closeFrame; if (byteBuf != null) { closeFrame = new CloseWebSocketFrame(true, 0, byteBuf); } else { closeFrame = new CloseWebSocketFrame(true, 0, 1000, null); } handshaker.close(chctx.channel(), closeFrame); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof CloseWebSocketFrame) { //readState = ReadState.Closed; handshaker.close(ctx.channel(), (CloseWebSocketFrame) msg) .addListener(ChannelFutureListener.CLOSE); } else { ctx.fireChannelRead(msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof CloseWebSocketFrame) { //readState = ReadState.Closed; handshaker.close(ctx.channel(), (CloseWebSocketFrame) msg) .addListener(ChannelFutureListener.CLOSE); } else { ctx.fireChannelRead(msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof CloseWebSocketFrame) { //readState = ReadState.Closed; handshaker.close(ctx.channel(), (CloseWebSocketFrame) msg) .addListener(ChannelFutureListener.CLOSE); } else { ctx.fireChannelRead(msg); } }
/** * Performs the closing handshake * * @param channel * Channel * @param frame * Closing Frame that was received */ public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) { if (channel == null) { throw new NullPointerException("channel"); } return close(channel, frame, channel.newPromise()); }
/** * Performs the closing handshake * * @param channel * Channel * @param frame * Closing Frame that was received */ public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) { if (channel == null) { throw new NullPointerException("channel"); } return close(channel, frame, channel.newPromise()); }
/** * Performs the closing handshake * * @param channel * Channel * @param frame * Closing Frame that was received */ public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) { if (channel == null) { throw new NullPointerException("channel"); } return close(channel, frame, channel.newPromise()); }
/** * Performs the closing handshake * * @param channel * Channel * @param frame * Closing Frame that was received */ public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) { if (channel == null) { throw new NullPointerException("channel"); } return close(channel, frame, channel.newPromise()); }