@Test
public void testEncodeEventStreamMultipleTimesWorkingCorrectly() throws IOException {

  EventMessage eventMessage1 =
      new EventMessage("urn:test", "123", 3000, 1000402, new byte[] {4, 3, 2, 1, 0});
  byte[] expectedEmsgBody1 =
      joinByteArrays(
          createByteArray(117, 114, 110, 58, 116, 101, 115, 116, 0), // scheme_id_uri = "urn:test"
          createByteArray(49, 50, 51, 0), // value = "123"
          createByteArray(0, 0, 11, 184), // event_duration_ms = 3000
          createByteArray(0, 15, 67, 210), // id = 1000402
          createByteArray(4, 3, 2, 1, 0)); // message_data = {4, 3, 2, 1, 0}
  EventMessageEncoder eventMessageEncoder = new EventMessageEncoder();
  byte[] encodedByteArray = eventMessageEncoder.encode(DECODED_MESSAGE);
  assertThat(encodedByteArray).isEqualTo(ENCODED_MESSAGE);
  byte[] encodedByteArray1 = eventMessageEncoder.encode(eventMessage1);
  assertThat(encodedByteArray1).isEqualTo(expectedEmsgBody1);
}