### Question:
ForwardedHeader { public static ForwardedHeader parse(HttpServletRequest request) { if (request.getHeaders(HEADER_NAME) == null) { return new ForwardedHeader(); } return parse(Collections.list(request.getHeaders(HEADER_NAME))); } private  ForwardedHeader(); List<String> getForValues(); List<String> getByValues(); List<String> getHostValues(); List<String> getProtoValues(); static ForwardedHeader parse(HttpServletRequest request); static ForwardedHeader parse(HttpContext context);  }### Answer:
@Test public void testParse() { String header1 = "for=192.0.2.43, for=198.51.100.17;proto=http;by=203.0.113.43;host=\"abc.123\\\";=fred\""; String header2 = "for=192.52.1.35"; HttpServletRequest request = mock(HttpServletRequest.class); when(request.getHeaders("Forwarded")).thenReturn(Collections.enumeration(Arrays.asList(header1, header2))); ForwardedHeader header = ForwardedHeader.parse(request); assertThat(header.getForValues()).containsExactly("192.0.2.43", "198.51.100.17", "192.52.1.35"); assertThat(header.getProtoValues()).containsExactly("http"); assertThat(header.getByValues()).containsExactly("203.0.113.43"); assertThat(header.getHostValues()).containsExactly("abc.123\";=fred"); }