Package org.apache.http.conn

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


            }
        });
        abortingThread.start();

        try {
            conn.open(route, httpContext, defaultParams);
            Assert.fail("expected SocketException");
        } catch(SocketException expected) {}

        abortingThread.join(5000);
        if(throwRef.get() != null)
View Full Code Here


            }
        });
        abortingThread.start();

        try {
            conn.open(route, httpContext, defaultParams);
            Assert.fail("expected exception");
        } catch(IOException expected) {
            Assert.assertEquals("Connection already shutdown", expected.getMessage());
        }
View Full Code Here

            }
        });
        abortingThread.start();

        try {
            conn.open(route, httpContext, defaultParams);
            Assert.fail("expected SocketException");
        } catch(SocketException expected) {}

        abortingThread.join(5000);
        if(throwRef.get() != null)
View Full Code Here

            }
        });
        abortingThread.start();

        try {
            conn.open(route, httpContext, defaultParams);
            Assert.fail("expected exception");
        } catch(IOException iox) {
            Assert.assertEquals("Request aborted", iox.getMessage());
        }
View Full Code Here

        assertTrue(conn instanceof AbstractClientConnAdapter);
        ((AbstractClientConnAdapter) conn).abortConnection();
       
        conn = mgr.getConnection(route, null);
        assertFalse("connection should have been closed", conn.isOpen());
        conn.open(route, httpContext, defaultParams);

        mgr.releaseConnection(conn, -1, null);
        mgr.shutdown();
    }
   
View Full Code Here

        HttpRequest request =
            new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);

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

        // a new context is created for each testcase, no need to reset
        HttpResponse response = Helper.execute(
                request, conn, target,
                httpExecutor, httpProcessor, defaultParams, httpContext);
View Full Code Here

        mgr.releaseConnection(conn, 100, TimeUnit.MILLISECONDS);
        conn = mgr.getConnection(route, null);
        assertFalse("connection should have been closed", conn.isOpen());

        // repeat the communication, no need to prepare the request again
        conn.open(route, httpContext, defaultParams);
        httpContext.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
        response = httpExecutor.execute(request, conn, httpContext);
        httpExecutor.postProcess(response, httpProcessor, httpContext);

        assertEquals("wrong status in second response",
View Full Code Here

        Thread.sleep(150);
        conn =  mgr.getConnection(route, null);
        assertTrue("connection should have been closed", !conn.isOpen());
       
        // repeat the communication, no need to prepare the request again
        conn.open(route, httpContext, defaultParams);
        httpContext.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
        response = httpExecutor.execute(request, conn, httpContext);
        httpExecutor.postProcess(response, httpProcessor, httpContext);

        assertEquals("wrong status in third response",
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);
        mgr.releaseConnection(conn, 100, TimeUnit.MILLISECONDS);
       
        mgr.closeExpiredConnections();
       
        conn = mgr.getConnection(route, null);
View Full Code Here

        HttpRequest request =
            new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);

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

        // a new context is created for each testcase, no need to reset
        HttpResponse response = Helper.execute(
                request, conn, target,
                httpExecutor, httpProcessor, defaultParams, httpContext);
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.