Examples of GetRequest


Examples of org.xlightweb.GetRequest

        server.start();
       
        HttpClient httpClient = new HttpClient();
        httpClient.setCacheMaxSizeKB(100);
       
        IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertEquals("test", resp.getBody().readString());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertTrue(resp.getHeader(CacheHandler.XHEADER_NAME).startsWith("HIT"));
        Assert.assertEquals("test", resp.getBody().readString());
       
       
View Full Code Here

Examples of org.xlightweb.GetRequest

        server.start();
       
        HttpClient httpClient = new HttpClient();
        httpClient.setCacheMaxSizeKB(100);
       
        IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertEquals("test", resp.getBody().readString());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
        Assert.assertEquals("test", resp.getBody().readString());
       
       
View Full Code Here

Examples of org.xlightweb.GetRequest

        server.start();
       
        HttpClient httpClient = new HttpClient();
        httpClient.setCacheMaxSizeKB(100);
       
        IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertEquals("test", resp.getBody().readString());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
        Assert.assertEquals("test", resp.getBody().readString());
       
       
View Full Code Here

Examples of org.xlightweb.GetRequest

     
      NonBlockingConnectionPool pool = new NonBlockingConnectionPool();
             
        for (int i = 0; i < 1000; i++) {
            HttpClientConnection httpCon = new HttpClientConnection(pool.getNonBlockingConnection("localhost", server.getLocalPort()));
            IHttpResponse resp = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
       
            InputStream in = Channels.newInputStream(resp.getBlockingBody());
            in.close();
               
            httpCon.close();
View Full Code Here

Examples of org.xlightweb.GetRequest

      server.start();
     
      HttpClientConnectionPool pool = new HttpClientConnectionPool();
             
      HttpClientConnection httpCon = pool.getHttpClientConnection("localhost", server.getLocalPort());
      IHttpResponse resp = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
       
      InputStream in = Channels.newInputStream(resp.getBlockingBody());
      in.close();

View Full Code Here

Examples of org.xlightweb.GetRequest

     
      HttpClientConnectionPool pool = new HttpClientConnectionPool();
             
        for (int i = 0; i < 1000; i++) {
            HttpClientConnection httpCon = pool.getHttpClientConnection("localhost", server.getLocalPort());
            IHttpResponse resp = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
       
            InputStream in = Channels.newInputStream(resp.getBlockingBody());
            in.close();
            System.out.print(".");
        }
View Full Code Here

Examples of org.xlightweb.GetRequest

   
    HttpClient httpClient = new HttpClient(SSLTestContextFactory.getSSLContext());
    httpClient.setProxyHost("localhost");
    httpClient.setProxyPort(proxy.getLocalPort());

    GetRequest request = new GetRequest("http://www.amazon.de/");
    IHttpResponse response = httpClient.call(request);
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertTrue(response.getBlockingBody().readString().indexOf("amazon") != -1);
   
View Full Code Here

Examples of org.xlightweb.GetRequest

    httpClient.setProxySecuredHost("localhost");
    httpClient.setProxySecuredPort(proxy.getLocalPort());
    httpClient.setProxyUser("test");
    httpClient.setProxyPassword("test");

    IHttpResponse response = httpClient.call(new GetRequest("https://localhost:" + server.getLocalPort() + "/"));
   
    String body = response.getBlockingBody().readString();

    Assert.assertEquals(200, response.getStatus());
    Assert.assertTrue(body.indexOf("it works") != -1);
View Full Code Here

Examples of org.xlightweb.GetRequest

        httpClient.setProxyHost("localhost");
        httpClient.setProxyPort(proxy.getLocalPort());
        httpClient.setProxyUser("test");
        httpClient.setProxyPassword("test");

        IHttpResponse response = httpClient.call(new GetRequest("https://localhost:" + server.getLocalPort() + "/"));
       
        String body = response.getBlockingBody().readString();

        Assert.assertEquals(200, response.getStatus());
        Assert.assertTrue(body.indexOf("it works") != -1);
View Full Code Here

Examples of org.xlightweb.GetRequest

    httpClient.setProxyPort(proxy.getLocalPort());
    httpClient.setProxyUser("test");
    httpClient.setProxyPassword("test");
   

    IHttpResponse response = httpClient.call(new GetRequest("http://www.amazon.de/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertTrue(response.getBlockingBody().readString().indexOf("amazon") != -1);
   
   
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.