KafkaHeaders { static void replaceHeader(Headers headers, String key, String value) { headers.remove(key); headers.add(key, value.getBytes(UTF_8)); } KafkaHeaders();   }
@Test public void replaceHeader() { KafkaHeaders.replaceHeader(record.headers(), "b3", "1"); assertThat(record.headers().lastHeader("b3").value()) .containsExactly('1'); }
@Test public void replaceHeader_replace() { record.headers().add("b3", new byte[0]); KafkaHeaders.replaceHeader(record.headers(), "b3", "1"); assertThat(record.headers().lastHeader("b3").value()) .containsExactly('1'); }