### Question:
UriUtils { public static void copyRequestHeaders(HttpRequest origRequest, HttpRequest req, DisallowedHeaders... disallowedRequestHeaders) { Set<String> allDisallowedHeaders = new HashSet<String>(); for (DisallowedHeaders h : disallowedRequestHeaders) { allDisallowedHeaders.addAll(h.getDisallowedHeaders()); } for (Map.Entry<String, List<String>> inHeader : origRequest.getHeaders().entrySet()) { String header = inHeader.getKey(); List<String> headerValues = inHeader.getValue(); if (headerValues != null && !headerValues.isEmpty() && isValidHeaderName(header) && !allDisallowedHeaders.contains(header.toLowerCase())) { req.removeHeader(header); for (String headerVal : headerValues) { if (isValidHeaderValue(headerVal)) { req.addHeader(header, headerVal); } } } } } private  UriUtils(); static boolean isValidHeaderName(String name); static boolean isValidHeaderValue(String val); static void copyResponseHeadersAndStatusCode(
      HttpResponse data, HttpResponseBuilder resp,
      boolean remapInternalServerError,
      boolean setHeaders,
      DisallowedHeaders... disallowedResponseHeaders); static void copyRequestHeaders(HttpRequest origRequest,
                                        HttpRequest req,
                                        DisallowedHeaders... disallowedRequestHeaders); static void copyRequestData(HttpRequest origRequest,
                                     HttpRequest req); static void maybeRewriteContentType(HttpRequest req, HttpResponseBuilder response); static String getContentTypeWithoutCharset(String content); static final String CHARSET; }### Answer:
@Test public void testCopyRequestHeaders() throws Exception { HttpRequest origRequest = new HttpRequest(Uri.parse("http: Map<String, List<String>> addedHeaders = ImmutableMap.<String, List<String>>builder() .put("h1", ImmutableList.of("v1", "v2")) .put("h2", ImmutableList.of("v3", "v4")) .put("hello\u2297", ImmutableList.of("v5", "v6")) .put("unchanged_header", ImmutableList.<String>of()) .put("Content-Length", ImmutableList.of("50", "100")) .build(); origRequest.addAllHeaders(addedHeaders); HttpRequest req = new HttpRequest(Uri.parse( "http: req.removeHeader(HttpRequest.DOS_PREVENTION_HEADER); req.addHeader("h1", "hello"); req.addHeader("Content-Length", "10"); req.addHeader("unchanged_header", "original_value"); UriUtils.copyRequestHeaders(origRequest, req, UriUtils.DisallowedHeaders.POST_INCOMPATIBLE_DIRECTIVES); Map<String, List<String>> headers = ImmutableMap.<String, List<String>>builder() .put("h1", ImmutableList.of("v1", "v2")) .put("h2", ImmutableList.of("v3", "v4")) .put("unchanged_header", ImmutableList.of("original_value")) .put("Content-Length", ImmutableList.of("10")) .put(HttpRequest.DOS_PREVENTION_HEADER, ImmutableList.of("on")) .build(); assertEquals(headers, req.getHeaders()); }