Package org.apache.http.impl.client

Examples of org.apache.http.impl.client.DefaultHttpClient.execute()


        client.getParams().setParameter(ClientPNames.DEFAULT_HEADERS, defaultHeaders);
       
        HttpGet httpget = new HttpGet("/oldlocation/");

       
        HttpResponse response = client.execute(getServerHttp(), httpget, context);
        HttpEntity e = response.getEntity();
        if (e != null) {
            e.consumeContent();
        }
       
View Full Code Here


        HttpResponse response;

        if(!relative) {
            String request = "http://" + host + ":" + port + uri;
            HttpGet httpget = new HttpGet(request);
            response = client.execute(httpget);
            response.getEntity().consumeContent()
        } else {
            HttpHost target = new HttpHost(host, port);
            HttpGet httpget = new HttpGet(uri);
            response = client.execute(target, httpget);
View Full Code Here

            response = client.execute(httpget);
            response.getEntity().consumeContent()
        } else {
            HttpHost target = new HttpHost(host, port);
            HttpGet httpget = new HttpGet(uri);
            response = client.execute(target, httpget);
            response.getEntity().consumeContent()
        }
       
        assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());      
        assertEquals(uri, listener.getRequestedUri());
View Full Code Here

        // Get some random data
        HttpGet httpget = new HttpGet("/random/20000");
        HttpHost target = getServerHttp();
       
        HttpResponse response = client.execute(target, httpget);

        ClientConnectionRequest connreq = mgr.requestConnection(new HttpRoute(target), null);
        try {
            connreq.getConnection(250, TimeUnit.MILLISECONDS);
            fail("ConnectionPoolTimeoutException should have been thrown");
View Full Code Here

        // Get some random data
        HttpGet httpget = new HttpGet("/random/20000");
        HttpHost target = getServerHttp();
       
        HttpResponse response = client.execute(target, httpget);

        ClientConnectionRequest connreq = mgr.requestConnection(new HttpRoute(target), null);
        try {
            connreq.getConnection(250, TimeUnit.MILLISECONDS);
            fail("ConnectionPoolTimeoutException should have been thrown");
View Full Code Here

        // Get some random data
        HttpGet httpget = new HttpGet("/random/20000");
        HttpHost target = getServerHttp();
       
        HttpResponse response = client.execute(target, httpget);

        ClientConnectionRequest connreq = mgr.requestConnection(new HttpRoute(target), null);
        try {
            connreq.getConnection(250, TimeUnit.MILLISECONDS);
            fail("ConnectionPoolTimeoutException should have been thrown");
View Full Code Here

        // Get some random data
        HttpGet httpget = new HttpGet("/dropdead");
        HttpHost target = getServerHttp();
       
        HttpResponse response = client.execute(target, httpget);

        ClientConnectionRequest connreq = mgr.requestConnection(new HttpRoute(target), null);
        try {
            connreq.getConnection(250, TimeUnit.MILLISECONDS);
            fail("ConnectionPoolTimeoutException should have been thrown");
View Full Code Here

                params, supportedSchemes);

        DefaultHttpClient client = new DefaultHttpClient(mgr, params);
        HttpHost target = new HttpHost(saddress.getHostName(), saddress.getPort(), "http");
       
        HttpResponse response = client.execute(target, new HttpGet("/random/2000"));
        if(response.getEntity() != null)
            response.getEntity().consumeContent();
       
        assertEquals(1, mgr.getConnectionsInPool());
        assertEquals(1, localServer.getAcceptedConnectionCount());
View Full Code Here

            response.getEntity().consumeContent();
       
        assertEquals(1, mgr.getConnectionsInPool());
        assertEquals(1, localServer.getAcceptedConnectionCount());
       
        response = client.execute(target, new HttpGet("/random/2000"));
        if(response.getEntity() != null)
            response.getEntity().consumeContent();
       
        assertEquals(1, mgr.getConnectionsInPool());
        assertEquals(1, localServer.getAcceptedConnectionCount());
View Full Code Here

        assertEquals(1, mgr.getConnectionsInPool());
        assertEquals(1, localServer.getAcceptedConnectionCount());
       
        // Now sleep for 1.1 seconds and let the timeout do its work
        Thread.sleep(1100);
        response = client.execute(target, new HttpGet("/random/2000"));
        if(response.getEntity() != null)
            response.getEntity().consumeContent();
       
        assertEquals(1, mgr.getConnectionsInPool());
        assertEquals(2, localServer.getAcceptedConnectionCount());
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.