Examples of HttpClientConnection


Examples of org.xlightweb.client.HttpClientConnection

      server.start();
     
      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.client.HttpClientConnection

            
        HttpClientConnectionPool pool = new HttpClientConnectionPool();

       
        for (int i = 0; i < 100; i++) {
            HttpClientConnection con = pool.getHttpClientConnection("localhost", container.getLocalPort());
           
            FutureResponseHandler respHdl = new FutureResponseHandler();
            BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + container.getLocalPort() + "/test"), respHdl);
           
            dataSink.write("test");
           
            IHttpResponse response = respHdl.getResponse();
            Assert.assertEquals(200, response.getStatus());
           
            BlockingBodyDataSource dataSource = response.getBlockingBody();
            Assert.assertEquals("test", dataSource.readStringByLength(4));
           
            dataSink.write("12345");
            Assert.assertEquals("12345", dataSource.readStringByLength(5));
           
            dataSink.write("789");
            Assert.assertEquals("789", dataSource.readStringByLength(3));
           
            dataSink.close();
            con.close();   
           
            System.out.print(".");
        }
       
       
View Full Code Here

Examples of org.xlightweb.client.HttpClientConnection

   
    IServer server = new Server(hdl);
    server.start();
   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    IHttpResponse response = con.call(new GetRequest("/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12345", response.getBlockingBody().readString());
    Assert.assertEquals("me", response.getServer());
   
    con.close();
    server.close();
  }
View Full Code Here

Examples of org.xlightweb.client.HttpClientConnection

   
    IServer server = new Server(hdl);
    server.start();
   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    IHttpResponse response = con.call(new GetRequest("/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12345", response.getBlockingBody().readString());
    Assert.assertEquals("me", response.getServer());
    Assert.assertEquals("", response.getHeader("ETag"));
   
    con.close();
    server.close();
  }
View Full Code Here

Examples of org.xlightweb.client.HttpClientConnection

   
    IServer server = new Server(hdl);
    server.start();
   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    IHttpResponse response = con.call(new GetRequest("/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12345", response.getBlockingBody().readString());
    Assert.assertEquals("its me", response.getServer());
   
    con.close();
    server.close();
  }
View Full Code Here

Examples of org.xlightweb.client.HttpClientConnection

   
    IServer server = new Server(hdl);
    server.start();
   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    IHttpResponse response = con.call(new GetRequest("/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12345", response.getBlockingBody().readString());
    Assert.assertEquals("its me", response.getServer());
   
    con.close();
    server.close();
  }
View Full Code Here

Examples of org.xlightweb.client.HttpClientConnection

   
    IServer server = new Server(hdl);
    server.start();
   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    IHttpResponse response = con.call(new GetRequest("/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12345", response.getBlockingBody().readString());
   
    con.close();
    server.close();
  }
View Full Code Here

Examples of org.xlightweb.client.HttpClientConnection

   
    IServer server = new Server(hdl);
    server.start();
   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    try {
      IHttpResponse response = con.call(new GetRequest("/"));
      response.getBlockingBody().readString();
      Assert.fail("IOException expected");
    } catch (IOException expected) {  }
   
    con.close();
    server.close();
  }
View Full Code Here

Examples of org.xlightweb.client.HttpClientConnection

   
    IServer server = new Server(hdl);
    server.start();
   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    IHttpResponse response = con.call(new GetRequest("/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12345", response.getBlockingBody().readString());
   
    con.close();
    server.close();
  }
View Full Code Here

Examples of org.xlightweb.client.HttpClientConnection

   
    IServer server = new Server(hdl);
    server.start();
   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    IHttpResponse response = con.call(new GetRequest("/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12345", response.getBlockingBody().readString());
   
    con.close();
    server.close();
  }
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.