@Test public void testHeaderEncode() throws Exception { TestUtils.MockProtocolEncoderOutput mockProtoEncoder = new TestUtils.MockProtocolEncoderOutput(); ConnAckEncoder encoder = new ConnAckEncoder(); ConnAckMessage msg = new ConnAckMessage(); encoder.encode(null, msg, mockProtoEncoder); assertEquals(0x20, mockProtoEncoder.getBuffer().get()); assertEquals(0x02, mockProtoEncoder.getBuffer().get()); assertEquals(ConnAckMessage.CONNECTION_ACCEPTED, mockProtoEncoder.getBuffer().skip(1).get()); }
public void encode(IoSession session, ConnAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.CONNACK << 4)); buff.put(Utils.encodeRemainingLength(2)); buff.put((byte) 0); buff.put(message.getReturnCode()).flip(); out.write(buff); }
ConnAckEncoder implements MessageEncoder<ConnAckMessage> { public void encode(IoSession session, ConnAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.CONNACK << 4)); buff.put(Utils.encodeRemainingLength(2)); buff.put((byte) 0); buff.put(message.getReturnCode()).flip(); out.write(buff); } }
ConnAckEncoder implements MessageEncoder<ConnAckMessage> { public void encode(IoSession session, ConnAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.CONNACK << 4)); buff.put(Utils.encodeRemainingLength(2)); buff.put((byte) 0); buff.put(message.getReturnCode()).flip(); out.write(buff); }  }
ConnAckEncoder implements MessageEncoder<ConnAckMessage> { public void encode(IoSession session, ConnAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.CONNACK << 4)); buff.put(Utils.encodeRemainingLength(2)); buff.put((byte) 0); buff.put(message.getReturnCode()).flip(); out.write(buff); }  void encode(IoSession session, ConnAckMessage message, ProtocolEncoderOutput out); }
ConnAckEncoder implements MessageEncoder<ConnAckMessage> { public void encode(IoSession session, ConnAckMessage message, ProtocolEncoderOutput out) throws Exception { IoBuffer buff = IoBuffer.allocate(4); buff.put((byte) (AbstractMessage.CONNACK << 4)); buff.put(Utils.encodeRemainingLength(2)); buff.put((byte) 0); buff.put(message.getReturnCode()).flip(); out.write(buff); }  void encode(IoSession session, ConnAckMessage message, ProtocolEncoderOutput out);  }