Package org.apache.http.nio

Examples of org.apache.http.nio.NHttpClientConnection


        }

        @Override
        public Void answer(final InvocationOnMock invocation) throws Throwable {
            final Object[] args = invocation.getArguments();
            final NHttpClientConnection conn = (NHttpClientConnection) args[0];
            if (conn != null) {
                final HttpResponse response = conn.getHttpResponse();
                if (response != null) {
                    responses.add(response);
                }
            }
            return null;
View Full Code Here


        this.connpool = new BasicNIOConnPool(this.ioReactor, new NIOConnFactory<HttpHost, NHttpClientConnection>() {

            @Override
            public NHttpClientConnection create(
                final HttpHost route, final IOSession session) throws IOException {
                final NHttpClientConnection conn = connFactory.create(route, session);
                conn.setSocketTimeout(timeout);
                return conn;
            }

        }, 0);
    }
View Full Code Here

                this.connectTimeout, TimeUnit.MILLISECONDS, null);
    }

    @Override
    protected void onLease(final BasicNIOPoolEntry entry) {
        final NHttpClientConnection conn = entry.getConnection();
        conn.setSocketTimeout(entry.getSocketTimeout());
    }
View Full Code Here

        conn.setSocketTimeout(entry.getSocketTimeout());
    }

    @Override
    protected void onRelease(final BasicNIOPoolEntry entry) {
        final NHttpClientConnection conn = entry.getConnection();
        entry.setSocketTimeout(conn.getSocketTimeout());
        conn.setSocketTimeout(0);
    }
View Full Code Here

        connFactory.create(route, session);
    }

    @Test
    public void testCreateEntry() throws Exception {
        final NHttpClientConnection conn = connFactory.create(route, session);
        final BasicNIOPoolEntry entry = pool.createEntry(route, conn);
        entry.close();
    }
View Full Code Here

        Args.notNull(responseConsumer, "HTTP response consumer");
        Args.notNull(connPool, "HTTP connection pool");
        Args.notNull(poolEntry, "Pool entry");
        Args.notNull(context, "HTTP context");
        final BasicFuture<T> future = new BasicFuture<T>(callback);
        final NHttpClientConnection conn = poolEntry.getConnection();
        final BasicAsyncClientExchangeHandler<T> handler = new BasicAsyncClientExchangeHandler<T>(
                requestProducer, responseConsumer,
                new RequestExecutionCallback<T, E>(future, poolEntry, connPool),
                context, conn,
                this.httppocessor, this.connReuseStrategy);
View Full Code Here

        public void completed(final E result) {
            if (this.requestFuture.isDone()) {
                this.connPool.release(result, true);
                return;
            }
            final NHttpClientConnection conn = result.getConnection();
            final BasicAsyncClientExchangeHandler<T> handler = new BasicAsyncClientExchangeHandler<T>(
                    this.requestProducer, this.responseConsumer,
                    new RequestExecutionCallback<T, E>(this.requestFuture, result, this.connPool),
                    this.context, conn, httppocessor, connReuseStrategy);
            initExection(handler, conn);
View Full Code Here

            this.request = request;
        }

        public Void answer(final InvocationOnMock invocation) throws Throwable {
            final Object[] args = invocation.getArguments();
            final NHttpClientConnection conn = (NHttpClientConnection) args[0];
            conn.submitRequest(request);
            return null;
        }
View Full Code Here

            this.responses = responses;
        }

        public Void answer(final InvocationOnMock invocation) throws Throwable {
            final Object[] args = invocation.getArguments();
            final NHttpClientConnection conn = (NHttpClientConnection) args[0];
            if (conn != null) {
                final HttpResponse response = conn.getHttpResponse();
                if (response != null) {
                    responses.add(response);
                }
            }
            return null;
View Full Code Here

    public BasicNIOConnFactory(final ConnectionConfig config) {
        this(new DefaultNHttpClientConnectionFactory(config), null);
    }

    public NHttpClientConnection create(final HttpHost route, final IOSession session) throws IOException {
        NHttpClientConnection conn;
        if (route.getSchemeName().equalsIgnoreCase("https")) {
            if (this.sslFactory == null) {
                throw new IOException("SSL not supported");
            }
            conn = this.sslFactory.createConnection(session);
View Full Code Here

TOP

Related Classes of org.apache.http.nio.NHttpClientConnection

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.