@Test void gzippedSpans() throws IOException {
    byte[] spansInJson = SpanBytesEncoder.JSON_V1.encodeList(spans);

    ByteString gzippedJson;
    try (Buffer sink = new Buffer(); Buffer source = new Buffer()) {
      source.write(spansInJson);
      GzipSink gzipSink = new GzipSink(sink);
      gzipSink.write(source, spansInJson.length);
      gzipSink.close();
      gzippedJson = sink.readByteString();
    }

    try (Response response = client.newCall(
      new Request.Builder().url(zipkin.httpUrl() + "/api/v1/spans")
        .addHeader("Content-Encoding", "gzip")
        .post(RequestBody.create(MediaType.parse("application/json"), gzippedJson))
        .build()).execute()) {
      assertThat(response.code()).isEqualTo(202);
    }

    assertThat(zipkin.collectorMetrics().bytes()).isEqualTo(spansInJson.length);
  }
Normally, a span can be reported twice: for client and server. However, there are bugs that
happened where several updates went to the same span id. {@link ZipkinExtension#collectorMetrics}
can be used to help ensure a span isn't reported more times than expected.
zipkin-junit5/src/test/java/zipkin2/junit5/ZipkinExtensionTest.java