Code example for BasicHttpRequest

Methods: getFirstHeader

        assertEquals("whatever", header.getValue());
    public void testRequestUserAgentMissingUserAgent() throws Exception { 
        HttpContext context = new BasicHttpContext(null);
        BasicHttpRequest request = new BasicHttpRequest("GET", "/");
        RequestUserAgent interceptor = new RequestUserAgent();
        interceptor.process(request, context);
        Header header = request.getFirstHeader(HTTP.USER_AGENT);
    public void testRequestUserAgentInvalidInput() throws Exception { 
        RequestUserAgent interceptor = new RequestUserAgent();
        try { 
            interceptor.process(null, null);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected 
Connect your IDE to all the code out there  Get Codota for Java