Package org.apache.http

Examples of org.apache.http.HttpResponseInterceptor


  }

  @Test
  public void testAddInterceptorHttpResponseInterceptor() {
    HttpProcessorBuilder builder = new HttpProcessorBuilder();
    builder.addInterceptor(new HttpResponseInterceptor() {
      @Override
      public void process(HttpResponse response, HttpContext context)
          throws HttpException, IOException {
      }
    });
View Full Code Here


    //socket.close();
  }

  @Test
  public void testSetHttpResponseInterceptor() {
    HttpResponseInterceptor interceptor = new HttpResponseInterceptor() {
      @Override
      public void process(HttpResponse response, HttpContext context)
          throws HttpException, IOException {
      }
    };
View Full Code Here

    });
  }

  @Test
  public void testAddHttpResponseInterceptor() {
    handler.addHttpResponseInterceptor(new HttpResponseInterceptor() {
      @Override
      public void process(HttpResponse response, HttpContext context)
          throws org.apache.http.HttpException, IOException {       
      }
    });
View Full Code Here

    @Test
    public void testContentEncodingNoEntity() throws Exception {
        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
        final HttpContext context = new BasicHttpContext();

        final HttpResponseInterceptor interceptor = new ResponseContentEncoding();
        interceptor.process(response, context);
        final HttpEntity entity = response.getEntity();
        Assert.assertNull(entity);
    }
View Full Code Here

        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
        final StringEntity original = new StringEntity("plain stuff");
        response.setEntity(original);
        final HttpContext context = new BasicHttpContext();

        final HttpResponseInterceptor interceptor = new ResponseContentEncoding();
        interceptor.process(response, context);
        final HttpEntity entity = response.getEntity();
        Assert.assertNotNull(entity);
        Assert.assertTrue(entity instanceof StringEntity);
    }
View Full Code Here

        final StringEntity original = new StringEntity("encoded stuff");
        original.setContentEncoding("GZip");
        response.setEntity(original);
        final HttpContext context = new BasicHttpContext();

        final HttpResponseInterceptor interceptor = new ResponseContentEncoding();
        interceptor.process(response, context);
        final HttpEntity entity = response.getEntity();
        Assert.assertNotNull(entity);
        Assert.assertTrue(entity instanceof GzipDecompressingEntity);
    }
View Full Code Here

        final StringEntity original = new StringEntity("encoded stuff");
        original.setContentEncoding("x-gzip");
        response.setEntity(original);
        final HttpContext context = new BasicHttpContext();

        final HttpResponseInterceptor interceptor = new ResponseContentEncoding();
        interceptor.process(response, context);
        final HttpEntity entity = response.getEntity();
        Assert.assertNotNull(entity);
        Assert.assertTrue(entity instanceof GzipDecompressingEntity);
    }
View Full Code Here

        final StringEntity original = new StringEntity("encoded stuff");
        original.setContentEncoding("deFlaTe");
        response.setEntity(original);
        final HttpContext context = new BasicHttpContext();

        final HttpResponseInterceptor interceptor = new ResponseContentEncoding();
        interceptor.process(response, context);
        final HttpEntity entity = response.getEntity();
        Assert.assertNotNull(entity);
        Assert.assertTrue(entity instanceof DeflateDecompressingEntity);
    }
View Full Code Here

        final StringEntity original = new StringEntity("encoded stuff");
        original.setContentEncoding("identity");
        response.setEntity(original);
        final HttpContext context = new BasicHttpContext();

        final HttpResponseInterceptor interceptor = new ResponseContentEncoding();
        interceptor.process(response, context);
        final HttpEntity entity = response.getEntity();
        Assert.assertNotNull(entity);
        Assert.assertTrue(entity instanceof StringEntity);
    }
View Full Code Here

        final StringEntity original = new StringEntity("encoded stuff");
        original.setContentEncoding("whatever");
        response.setEntity(original);
        final HttpContext context = new BasicHttpContext();

        final HttpResponseInterceptor interceptor = new ResponseContentEncoding();
        interceptor.process(response, context);
    }
View Full Code Here

TOP

Related Classes of org.apache.http.HttpResponseInterceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.