/** Constructor for when receiving a message from the server */
  public JBossMessage(final ClientMessage message, ClientSession session) {
    this.message = message;

    this.readOnly = true;

    this.session = session;

    this.body = message.getBody();
  }
  public JBossMessage(byte type) {
    message =
        new ClientMessageImpl(
            type,
            true,
            0,
            System.currentTimeMillis(),
            (byte) 4,
            new ByteBufferWrapper(ByteBuffer.allocate(1024)));

    // TODO - can we lazily create this?
    body = message.getBody();
  }
 public void doBeforeReceive() throws Exception {
   body = message.getBody();
 }
  /*
   * Create a new message prior to sending
   */
  protected JBossMessage(final byte type, final ClientSession session) {
    message = session.createClientMessage(type, true, 0, System.currentTimeMillis(), (byte) 4);

    // TODO - can we lazily create this?
    body = message.getBody();
  }