static AmqpMessage CreateMessage(AmqpMessage source, int segmentSize) { ByteBuffer[] buffers = ReadMessagePayLoad(source, segmentSize); AmqpMessage message = AmqpMessage.CreateReceivedMessage(); for (int i = 0; i < buffers.Length; i++) { message.AddPayload(buffers[i], i == buffers.Length - 1); buffers[i].Dispose(); } return(message); }