class RequestAcceptEncoding implements HttpRequestInterceptor {

    public void process(
            final HttpRequest request,
            final HttpContext context) throws HttpException, IOException {

        /* Signal support for Accept-Encoding transfer encodings. */
        request.addHeader("Accept-Encoding", "gzip,deflate");
    }

}

class TestRequestAcceptEncoding {

    @Test
    public void testAcceptEncoding() throws Exception {

        HttpRequest request = new BasicHttpRequest("GET", "/");
        HttpContext context = new BasicHttpContext();

        HttpRequestInterceptor interceptor = new RequestAcceptEncoding();
        interceptor.process(request, context);
        Header header = request.getFirstHeader("Accept-Encoding");
        Assert.assertNotNull(header);
        Assert.assertEquals("gzip,deflate", header.getValue());
    }

}