Package org.apache.http.conn

Examples of org.apache.http.conn.ManagedClientConnection.markReusable()


        data = EntityUtils.toByteArray(response.getEntity());
        Assert.assertEquals("wrong length of third response entity",
                     rsplen, data.length);
        // ignore data, but it must be read

        conn.markReusable();
        mgr.releaseConnection(conn, 100, TimeUnit.MILLISECONDS);
        Thread.sleep(150);
        conn =  mgr.getConnection(route, null);
        Assert.assertTrue("connection should have been closed", !conn.isOpen());
View Full Code Here


        final HttpHost target = getServerHttp();
        final HttpRoute route = new HttpRoute(target, null, false);

        ManagedClientConnection conn =  mgr.getConnection(route, null);
        conn.open(route, httpContext, defaultParams);
        conn.markReusable();
        mgr.releaseConnection(conn, 100, TimeUnit.MILLISECONDS);

        mgr.closeExpiredConnections();

        conn = mgr.getConnection(route, null);
View Full Code Here

        ManagedClientConnection conn = getConnection(mgr, route);

        Assert.assertEquals(1, mgr.getTotalStats().getLeased());
        Assert.assertEquals(1, mgr.getStats(route).getLeased());
        conn.markReusable();
        mgr.releaseConnection(conn, -1, null);

        Assert.assertEquals(1, mgr.getTotalStats().getAvailable());
        Assert.assertEquals(1, mgr.getStats(route).getAvailable());
View Full Code Here

                     rsplen, data.length);
        // ignore data, but it must be read

        // release connection after marking it for re-use
        // expect the next connection obtained to be open
        conn.markReusable();
        mgr.releaseConnection(conn, -1, null);
        conn = getConnection(mgr, route);
        Assert.assertTrue("connection should have been open", conn.isOpen());

        // repeat the communication, no need to prepare the request again
View Full Code Here

                     rsplen, data.length);
        // ignore data, but it must be read

        // release connection after marking it for re-use
        // expect the next connection obtained to be open
        conn.markReusable();
        mgr.releaseConnection(conn, 100, TimeUnit.MILLISECONDS);
        conn = getConnection(mgr, route);
        Assert.assertTrue("connection should have been open", conn.isOpen());

        // repeat the communication, no need to prepare the request again
View Full Code Here

        data = EntityUtils.toByteArray(response.getEntity());
        Assert.assertEquals("wrong length of third response entity",
                     rsplen, data.length);
        // ignore data, but it must be read

        conn.markReusable();
        mgr.releaseConnection(conn, 100, TimeUnit.MILLISECONDS);
        Thread.sleep(150);
        conn = getConnection(mgr, route);
        Assert.assertTrue("connection should have been closed", !conn.isOpen());
View Full Code Here

        ManagedClientConnection conn = getConnection(mgr, route);
        conn.open(route, httpContext, defaultParams);

        Assert.assertEquals(1, mgr.getTotalStats().getLeased());
        Assert.assertEquals(1, mgr.getStats(route).getLeased());
        conn.markReusable();
        mgr.releaseConnection(conn, 100, TimeUnit.MILLISECONDS);

        // Released, still active.
        Assert.assertEquals(1, mgr.getTotalStats().getAvailable());
        Assert.assertEquals(1, mgr.getStats(route).getAvailable());
View Full Code Here

        conn.open(route, httpContext, defaultParams);

        Assert.assertEquals(1, mgr.getTotalStats().getLeased());
        Assert.assertEquals(1, mgr.getStats(route).getLeased());
        // Release, let remain idle for forever
        conn.markReusable();
        mgr.releaseConnection(conn, -1, TimeUnit.MILLISECONDS);

        // Released, still active.
        Assert.assertEquals(1, mgr.getTotalStats().getAvailable());
        Assert.assertEquals(1, mgr.getStats(route).getAvailable());
View Full Code Here

                                        wrappedConnection.layerProtocol(context, params);
                                    }

                                    @Override
                                    public void markReusable() {
                                        wrappedConnection.markReusable();
                                    }

                                    @Override
                                    public void unmarkReusable() {
                                        wrappedConnection.unmarkReusable();
View Full Code Here

                     rsplen, data.length);
        // ignore data, but it must be read

        // release connection after marking it for re-use
        // expect the next connection obtained to be open
        conn.markReusable();
        mgr.releaseConnection(conn, -1, null);
        conn = getConnection(mgr, route);
        assertTrue("connection should have been open", conn.isOpen());

        // repeat the communication, no need to prepare the request again
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.