Package org.apache.http.nio.protocol

Examples of org.apache.http.nio.protocol.BufferingAsyncRequestHandler


    }

    @Test
    public void testBasicRedirect307() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(
                new BasicRedirectService(getSchemeName(), HttpStatus.SC_TEMPORARY_REDIRECT)));
        HttpHost target = start(registry, null);

        HttpContext context = new BasicHttpContext();

View Full Code Here


    }

    @Test(expected=ExecutionException.class)
    public void testMaxRedirectCheck() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(new CircularRedirectService()));
        HttpHost target = start(registry, null);

        this.httpclient.getParams().setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
        this.httpclient.getParams().setIntParameter(ClientPNames.MAX_REDIRECTS, 5);

View Full Code Here

    }

    @Test(expected=ExecutionException.class)
    public void testCircularRedirect() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(new CircularRedirectService()));
        HttpHost target = start(registry, null);

        this.httpclient.getParams().setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, false);

        HttpGet httpget = new HttpGet("/circular-oldlocation/");
View Full Code Here

    }

    @Test
    public void testPostNoRedirect() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(
                new BasicRedirectService(getSchemeName(), HttpStatus.SC_MOVED_TEMPORARILY)));
        HttpHost target = start(registry, null);

        HttpContext context = new BasicHttpContext();

View Full Code Here

    }

    @Test
    public void testPostRedirectSeeOther() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(
                new BasicRedirectService(getSchemeName(), HttpStatus.SC_SEE_OTHER)));
        HttpHost target = start(registry, null);

        HttpContext context = new BasicHttpContext();

View Full Code Here

    }

    @Test
    public void testRelativeRedirect() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(new RelativeRedirectService()));
        HttpHost target = start(registry, null);

        HttpContext context = new BasicHttpContext();

        this.httpclient.getParams().setBooleanParameter(
View Full Code Here

    }

    @Test
    public void testRelativeRedirect2() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(new RelativeRedirectService2()));
        HttpHost target = start(registry, null);

        HttpContext context = new BasicHttpContext();

        this.httpclient.getParams().setBooleanParameter(
View Full Code Here

    }

    @Test(expected=ExecutionException.class)
    public void testRejectRelativeRedirect() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(new RelativeRedirectService()));
        HttpHost target = start(registry, null);

        this.httpclient.getParams().setBooleanParameter(
                ClientPNames.REJECT_RELATIVE_REDIRECT, true);
        HttpGet httpget = new HttpGet("/oldlocation/");
View Full Code Here

    }

    @Test(expected=ExecutionException.class)
    public void testRejectBogusRedirectLocation() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(
                new BogusRedirectService(getSchemeName(), "xxx://bogus", true)));
        HttpHost target = start(registry, null);

        HttpGet httpget = new HttpGet("/oldlocation/");

View Full Code Here

    }

    @Test(expected=ExecutionException.class)
    public void testRejectInvalidRedirectLocation() throws Exception {
        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("*", new BufferingAsyncRequestHandler(
                new BogusRedirectService(getSchemeName(), "/newlocation/?p=I have spaces", false)));
        HttpHost target = start(registry, null);

        HttpGet httpget = new HttpGet("/oldlocation/");
        try {
View Full Code Here

TOP

Related Classes of org.apache.http.nio.protocol.BufferingAsyncRequestHandler

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.