### Question:
HttpHeaders implements Iterable<HttpHeader> { public Optional<String> get(CharSequence name) { return Optional.ofNullable(nettyHeaders.get(name)); } private  HttpHeaders(Builder builder); Set<String> names(); Optional<String> get(CharSequence name); List<String> getAll(CharSequence name); boolean contains(CharSequence name); @Override Iterator<HttpHeader> iterator(); void forEach(BiConsumer<String, String> consumer); Builder newBuilder(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void providesSingleHeaderValue() { assertThat(headers.get("header1").get(), is("val1")); }
@Test public void providesFirstHeaderValueWhenSeveralExist() { assertThat(headers.get("header2").get(), is("val2a")); }
@Test public void providesOptionalAbsentWhenNoSuchHeaderExists() { assertThat(headers.get("nonExistent"), isAbsent()); }
@Test public void setsDateHeaders() { Instant time = ZonedDateTime.of(2015, 9, 10, 12, 2, 28, 0, UTC).toInstant(); HttpHeaders headers = new HttpHeaders.Builder() .set("foo", time) .build(); assertThat(headers.get("foo"), isValue("Thu, 10 Sep 2015 12:02:28 GMT")); }