@Test void utf8_malformed() {
    for (int codepoint : List.of(0xD800, 0xDFFF, 0xD83D)) {
      String test = new String(new int[] {'a', codepoint, 'c'}, 0, 3);
      assertThat(WriteBuffer.utf8SizeInBytes(test))
        .isEqualTo(3);

      byte[] bytes = new byte[3];
      WriteBuffer.wrap(bytes).writeUtf8(test);
      assertThat(bytes)
        .containsExactly('a', '?', 'c');
    }
  }
Uses test data and codepoint wrapping trick from okhttp3.FormBodyTest
zipkin/src/test/java/zipkin2/internal/WriteBufferTest.java