@Test void skipsMalformedData() throws Exception {
    byte[] malformed1 = "[\"='".getBytes(UTF_8); // screwed up json
    byte[] malformed2 = "malformed".getBytes(UTF_8);
    pushMessage(collector.queue, THRIFT.encodeList(spans));
    pushMessage(collector.queue, new byte[0]);
    pushMessage(collector.queue, malformed1);
    pushMessage(collector.queue, malformed2);
    pushMessage(collector.queue, THRIFT.encodeList(spans));

    Thread.sleep(1000);

    assertThat(activemqMetrics.messages()).isEqualTo(5);
    assertThat(activemqMetrics.messagesDropped()).isEqualTo(2); // only malformed, not empty
    assertThat(activemqMetrics.bytes()).isEqualTo(
      THRIFT.encodeList(spans).length * 2 + malformed1.length + malformed2.length);
    assertThat(activemqMetrics.spans()).isEqualTo(spans.size() * 2);
    assertThat(activemqMetrics.spansDropped()).isZero();
  }
Ensures malformed spans don't hang the collector
zipkin-collector/activemq/src/test/java/zipkin2/collector/activemq/ITActiveMQCollector.java