Package org.apache.http.localserver

Examples of org.apache.http.localserver.HttpServerNio


            .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000)
            .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
            .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
            .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
            .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "TEST-SERVER/1.1");
        this.server = new HttpServerNio(createServerConnectionFactory(this.serverParams));
        this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
        this.serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                new ResponseDate(),
                new ResponseServer(),
                new ResponseContent(),
View Full Code Here


        final HttpHost redirectTarget = start(registry, null);

        final UriHttpAsyncRequestHandlerMapper registry2 = new UriHttpAsyncRequestHandlerMapper();
        registry2.register("/redirect/*", new BasicAsyncRequestHandler(
                new CrossSiteRedirectService(redirectTarget)));
        final HttpServerNio secondServer = new HttpServerNio(this.serverReactorConfig,
                createServerConnectionFactory(this.serverConnectionConfig));
        secondServer.setExceptionHandler(new SimpleIOReactorExceptionHandler());
        final HttpAsyncService serviceHandler = new HttpAsyncService(
                this.serverHttpProc,
                new DefaultConnectionReuseStrategy(),
                new DefaultHttpResponseFactory(),
                registry2,
                null);
        secondServer.start(serviceHandler);
        try {
            final ListenerEndpoint endpoint2 = secondServer.getListenerEndpoint();
            endpoint2.waitFor();

            Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, secondServer.getStatus());
            final InetSocketAddress address2 = (InetSocketAddress) endpoint2.getAddress();
            final HttpHost initialTarget = new HttpHost("localhost", address2.getPort(), getSchemeName());

            final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
            for (int i = 0; i < 4; i++) {
View Full Code Here

        }

    }

    public void initServer() throws Exception {
        this.server = new HttpServerNio(
                this.serverReactorConfig, createServerConnectionFactory(this.serverConnectionConfig));
        this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
        this.serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                new ResponseDate(),
                new ResponseServer("TEST-SERVER/1.1"),
View Full Code Here

            .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000)
            .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
            .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
            .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
            .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "TEST-SERVER/1.1");
        this.server = new HttpServerNio(createServerConnectionFactory(this.serverParams));
        this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
        this.serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                new ResponseDate(),
                new ResponseServer(),
                new ResponseContent(),
View Full Code Here

        }

    }

    public void initServer() throws Exception {
        this.server = new HttpServerNio(
                this.serverReactorConfig, createServerConnectionFactory(this.serverConnectionConfig));
        this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
        this.serverHttpProc = new ImmutableHttpProcessor(new ResponseDate(),
                new ResponseServer("TEST-SERVER/1.1"),
                new ResponseContent(),
View Full Code Here

        final HttpHost redirectTarget = start(registry, null);

        final UriHttpAsyncRequestHandlerMapper registry2 = new UriHttpAsyncRequestHandlerMapper();
        registry2.register("/redirect/*", new BasicAsyncRequestHandler(
                new CrossSiteRedirectService(redirectTarget)));
        final HttpServerNio secondServer = new HttpServerNio(this.serverReactorConfig,
                createServerConnectionFactory(this.serverConnectionConfig));
        secondServer.setExceptionHandler(new SimpleIOReactorExceptionHandler());
        final HttpAsyncService serviceHandler = new HttpAsyncService(
                this.serverHttpProc,
                new DefaultConnectionReuseStrategy(),
                new DefaultHttpResponseFactory(),
                registry2,
                null);
        secondServer.start(serviceHandler);
        try {
            final ListenerEndpoint endpoint2 = secondServer.getListenerEndpoint();
            endpoint2.waitFor();

            Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, secondServer.getStatus());
            final InetSocketAddress address2 = (InetSocketAddress) endpoint2.getAddress();
            final HttpHost initialTarget = new HttpHost("localhost", address2.getPort(), getSchemeName());

            final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
            for (int i = 0; i < 4; i++) {
View Full Code Here

            .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000)
            .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
            .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
            .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
            .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "TEST-SERVER/1.1");
        this.server = new HttpServerNio(createServerConnectionFactory(this.serverParams));
        this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
        this.serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                new ResponseDate(),
                new ResponseServer(),
                new ResponseContent(),
View Full Code Here

        HttpHost redirectTarget = start(registry, null);

        HttpAsyncRequestHandlerRegistry registry2 = new HttpAsyncRequestHandlerRegistry();
        registry2.register("/redirect/*", new BasicAsyncRequestHandler(
                new CrossSiteRedirectService(redirectTarget)));
        HttpServerNio secondServer = new HttpServerNio(createServerConnectionFactory(this.serverParams));
        secondServer.setExceptionHandler(new SimpleIOReactorExceptionHandler());
        HttpAsyncService serviceHandler = new HttpAsyncService(
                this.serverHttpProc,
                new DefaultConnectionReuseStrategy(),
                new DefaultHttpResponseFactory(),
                registry2,
                null,
                this.serverParams);
        secondServer.start(serviceHandler);
        try {
            ListenerEndpoint endpoint2 = secondServer.getListenerEndpoint();
            endpoint2.waitFor();

            Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, secondServer.getStatus());
            InetSocketAddress address2 = (InetSocketAddress) endpoint2.getAddress();
            HttpHost initialTarget = new HttpHost("localhost", address2.getPort(), getSchemeName());

            Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
            for (int i = 0; i < 4; i++) {
View Full Code Here

TOP

Related Classes of org.apache.http.localserver.HttpServerNio

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.