Package org.apache.http.nio.protocol

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


            final ContentType contentType) {
        return new ZeroCopyPut(URI.create(requestURI), content, contentType);
    }

    public static HttpAsyncResponseConsumer<HttpResponse> createConsumer() {
        return new BasicAsyncResponseConsumer();
    }
View Full Code Here


    @Test
    public void testRequestFailure() throws Exception {
        HttpHost target = start();
        HttpGet httpget = new HttpGet("/random/2048");
        HttpAsyncRequestProducer requestProducer = HttpAsyncMethods.create(target, httpget) ;
        BasicAsyncResponseConsumer responseConsumer = new BasicAsyncResponseConsumer() {

            @Override
            public void consumeContent(final ContentDecoder decoder, final IOControl ioctrl)
                    throws IOException {
                throw new IOException("Kaboom");
View Full Code Here

        HttpHost target = new HttpHost("localhost", ((InetSocketAddress)endpoint.getAddress()).getPort());
        BasicHttpRequest request = new BasicHttpRequest("GET", pattern + "x" + count);
        Future<HttpResponse> future = this.executor.execute(
                new BasicAsyncRequestProducer(target, request),
                new BasicAsyncResponseConsumer(),
                this.connpool);
        try {
            future.get();
            Assert.fail("ExecutionException should have been thrown");
        } catch (ExecutionException ex) {
View Full Code Here

        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());

        BasicHttpRequest request = new BasicHttpRequest("GET", "/");
        this.executor.execute(
                new BasicAsyncRequestProducer(target, request),
                new BasicAsyncResponseConsumer(),
                this.connpool);

        this.server.join(20000);

        Exception ex = this.server.getException();
View Full Code Here

        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());

        BasicHttpRequest request = new BasicHttpRequest("GET", "/");
        this.executor.execute(
                new BasicAsyncRequestProducer(target, request),
                new BasicAsyncResponseConsumer(),
                this.connpool);

        this.server.join(20000);

        Exception ex = this.server.getException();
View Full Code Here

        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());

        BasicHttpRequest request = new BasicHttpRequest("GET", "/");
        this.executor.execute(
                new BasicAsyncRequestProducer(target, request),
                new BasicAsyncResponseConsumer(),
                this.connpool);

        requestConns.await();
        Assert.assertEquals(0, requestConns.getCount());
View Full Code Here

        Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
        for (int i = 0; i < 30; i++) {
            BasicHttpRequest request = new BasicHttpRequest("GET", createRequestUri(pattern, count));
            Future<HttpResponse> future = this.executor.execute(
                    new BasicAsyncRequestProducer(target, request),
                    new BasicAsyncResponseConsumer(),
                    this.connpool);
            queue.add(future);
        }

        while (!queue.isEmpty()) {
View Full Code Here

        Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
        for (int i = 0; i < 30; i++) {
            BasicHttpRequest request = new BasicHttpRequest("HEAD", createRequestUri(pattern, count));
            Future<HttpResponse> future = this.executor.execute(
                    new BasicAsyncRequestProducer(target, request),
                    new BasicAsyncResponseConsumer(),
                    this.connpool);
            queue.add(future);
        }

        while (!queue.isEmpty()) {
View Full Code Here

                    "POST", createRequestUri(pattern, count));
            NStringEntity entity = NStringEntity.create(expectedPattern, ContentType.DEFAULT_TEXT);
            request.setEntity(entity);
            Future<HttpResponse> future = this.executor.execute(
                    new BasicAsyncRequestProducer(target, request),
                    new BasicAsyncResponseConsumer(),
                    this.connpool);
            queue.add(future);
        }

        while (!queue.isEmpty()) {
View Full Code Here

            NStringEntity entity = NStringEntity.create(expectedPattern, ContentType.DEFAULT_TEXT);
            entity.setChunked(true);
            request.setEntity(entity);
            Future<HttpResponse> future = this.executor.execute(
                    new BasicAsyncRequestProducer(target, request),
                    new BasicAsyncResponseConsumer(),
                    this.connpool);
            queue.add(future);
        }

        while (!queue.isEmpty()) {
View Full Code Here

TOP

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

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.