this.type = type;
}
public void encode( ProtocolSession session, Object message, ProtocolEncoderOutput out ) throws ProtocolViolationException
{
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 );