RequestCompiler { public static Optional<HeaderPair> compileHeader(final String line) { final Matcher matcher = PATTERN_HEADER.matcher(line); if (!matcher.matches()) { return Optional.empty(); } final AsciiString key = AsciiString.of(matcher.group(KEY).toLowerCase(Locale.ENGLISH)); final AsciiString value = AsciiString.of(matcher.group(VALUE), false); return Optional.of(new HeaderPair(key, value)); }  static Optional<HeaderPair> compileHeader(final String line); static void compileQuery(final AbstractRequest request, final String line);  }
@Test void compileHeader() { final Optional<HeaderPair> headerPairOptional = RequestCompiler.compileHeader("Random-Header: value"); Assertions.assertNotNull(headerPairOptional); Assertions.assertTrue(headerPairOptional.isPresent()); final HeaderPair headerPair = headerPairOptional.get(); Assertions.assertEquals("random-header", headerPair.getKey().toString()); Assertions.assertEquals("value", headerPair.getValue().toString()); }