data = new byte[length];
encoded = message.encode(data,0,length);
}
while (encoded == length || encoded < 0);
final SWIGTYPE_p_pn_message_t message_t = Proton.pn_message();
Proton.pn_message_decode(message_t, ByteBuffer.wrap(data, 0, encoded));
return message_t;
}