this.type = type;
}
public void encode(IoSession session, Object message,
ProtocolEncoderOutput out) throws Exception {
AbstractMessage m = (AbstractMessage) message;
ByteBuffer buf = ByteBuffer.allocate(16);
buf.setAutoExpand(true); // Enable auto-expand for easier encoding
// Encode a header
buf.putShort((short) type);
buf.putInt(m.getSequence());
// Encode a body
encodeBody(session, m, buf);
buf.flip();
out.write(buf);