@Override public void close() { close(StatusCode.NORMAL,null); }
/** * Incoming mux-unwrapped frames, destined for a sub-channel */ @Override public void onMuxedFrame(MuxedFrame frame) { MuxChannel subchannel = channels.get(frame.getChannelId()); subchannel.incomingFrame(frame); }
@Override public boolean isOpen() { return isActive() && muxer.isOpen(); }
/** * Internal * * @param frame the frame to write * @return the future for the network write of the frame */ private Future<Void> outgoingAsyncFrame(WebSocketFrame frame) { FutureWriteCallback future = new FutureWriteCallback(); outgoingFrame(frame,future); return future; }
public MuxChannel getChannel(long channelId, boolean create) { if (channelId == CONTROL_CHANNEL_ID) { throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"Invalid Channel ID"); } MuxChannel channel = channels.get(channelId); if (channel == null) { if (create) { channel = new MuxChannel(channelId,this); channels.put(channelId,channel); } else { throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"Unknown Channel ID"); } } return channel; }
/** * Internal * * @param frame the frame to write * @return the future for the network write of the frame */ private Future<Void> outgoingAsyncFrame(WebSocketFrame frame) { FutureWriteCallback future = new FutureWriteCallback(); outgoingFrame(frame,future); return future; }
public MuxChannel getChannel(long channelId, boolean create) { if (channelId == CONTROL_CHANNEL_ID) { throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"Invalid Channel ID"); } MuxChannel channel = channels.get(channelId); if (channel == null) { if (create) { channel = new MuxChannel(channelId,this); channels.put(channelId,channel); } else { throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"Unknown Channel ID"); } } return channel; }
@Override public void close(int statusCode, String reason) { CloseInfo close = new CloseInfo(statusCode,reason); // TODO: disconnect callback? outgoingFrame(close.asFrame(),null); }
@Override public void close() { close(StatusCode.NORMAL,null); }
@Override public boolean isOpen() { return isActive() && muxer.isOpen(); }
/** * Incoming mux-unwrapped frames, destined for a sub-channel */ @Override public void onMuxedFrame(MuxedFrame frame) { MuxChannel subchannel = channels.get(frame.getChannelId()); subchannel.incomingFrame(frame); }
@Override public void close(int statusCode, String reason) { CloseInfo close = new CloseInfo(statusCode,reason); // TODO: disconnect callback? outgoingFrame(close.asFrame(),null); }
/** * Incoming mux control block, destined for the control channel (id 0) */ @Override public void onMuxDropChannel(MuxDropChannel drop) { // Process channel long channelId = drop.getChannelId(); MuxChannel channel = getChannel(channelId,false); String reason = "Mux " + drop.toString(); reason = StringUtil.truncate(reason,(WebSocketFrame.MAX_CONTROL_PAYLOAD - 2)); channel.close(StatusCode.PROTOCOL,reason); // TODO: set channel to inactive? }
/** * Incoming mux control block, destined for the control channel (id 0) */ @Override public void onMuxDropChannel(MuxDropChannel drop) { // Process channel long channelId = drop.getChannelId(); MuxChannel channel = getChannel(channelId,false); String reason = "Mux " + drop.toString(); reason = StringUtil.truncate(reason,(WebSocketFrame.MAX_CONTROL_PAYLOAD - 2)); channel.close(StatusCode.PROTOCOL,reason); // TODO: set channel to inactive? }