@Test
public void testEncodeData_HasAttribute() throws Exception {
final String topic = "topic1";
final byte[] data = "hello".getBytes();
final String attribute = "attribute";
final Message message = new Message(topic, data, attribute);
final byte[] encoded = MessageUtils.encodePayload(message);
assertEquals(4 + attribute.length() + data.length, encoded.length);
assertEquals(attribute.length(), MessageUtils.getInt(0, encoded));
assertEquals(attribute, new String(encoded, 4, attribute.length()));
assertEquals("hello", new String(encoded, 4 + attribute.length(), data.length));