@Test
public void testEncodeDecodeEventStream() throws IOException {

  byte[] encodedByteArray = new EventMessageEncoder().encode(DECODED_MESSAGE);
  MetadataInputBuffer buffer = new MetadataInputBuffer();
  buffer.data = ByteBuffer.allocate(encodedByteArray.length).put(encodedByteArray);
  EventMessageDecoder decoder = new EventMessageDecoder();
  Metadata metadata = decoder.decode(buffer);
  assertThat(metadata.length()).isEqualTo(1);
  assertThat(metadata.get(0)).isEqualTo(DECODED_MESSAGE);
}