Package org.xlightweb.client

Examples of org.xlightweb.client.HttpClientConnection.call()


    server.start();
 
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    con.setBodyDataReceiveTimeoutMillis(1000);

    IHttpResponse response = con.call(new GetRequest("/?loops=3&waittime=200"));
    response.getBlockingBody().readString();
   
    response = con.call(new GetRequest("/?loops=1&waittime=2000"));
   
    try {
View Full Code Here


    con.setBodyDataReceiveTimeoutMillis(1000);

    IHttpResponse response = con.call(new GetRequest("/?loops=3&waittime=200"));
    response.getBlockingBody().readString();
   
    response = con.call(new GetRequest("/?loops=1&waittime=2000"));
   
    try {
      response.getBlockingBody().readString();
      Assert.fail("ReceiveTimeoutException expected");
    } catch (ReceiveTimeoutException expected) { }
View Full Code Here

      Server server = new Server(dh);
      server.start();
   
    HttpClientConnection httpCon = new HttpClientConnection("localhost", server.getLocalPort());
   
    IHttpResponse response = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
    Assert.assertEquals(400, response.getStatus());

    response = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
    Assert.assertEquals(400, response.getStatus());
   
View Full Code Here

    HttpClientConnection httpCon = new HttpClientConnection("localhost", server.getLocalPort());
   
    IHttpResponse response = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
    Assert.assertEquals(400, response.getStatus());

    response = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
    Assert.assertEquals(400, response.getStatus());
   
    httpCon.close();
    server.close();
  }
View Full Code Here

         Server server = new Server(dh);
         server.start();
        
         HttpClientConnection httpCon = new HttpClientConnection("localhost", server.getLocalPort());
        
         IHttpResponse response = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
         Assert.assertEquals(500, response.getStatus());

         try {
             response = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
             Assert.fail("ClosedChannelException expected");
View Full Code Here

        
         IHttpResponse response = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
         Assert.assertEquals(500, response.getStatus());

         try {
             response = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
             Assert.fail("ClosedChannelException expected");
         } catch (ClosedChannelException expected) { }
        
         server.close();
    
View Full Code Here

    for (int i = 0; i < 5; i++) {
     
      INonBlockingConnection con = pool.getNonBlockingConnection("localhost", server.getLocalPort());
      HttpClientConnection httpCon = new HttpClientConnection(con);
     
      IHttpResponse response =  httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/"));
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("12", response.getBlockingBody().readString());
    }
   
    QAUtil.sleep(1000);
View Full Code Here

    Assert.assertEquals(0, pool.getNumDestroyed());
   
   
    INonBlockingConnection con = pool.getNonBlockingConnection("localhost", server.getLocalPort());
    HttpClientConnection httpCon = new HttpClientConnection(con);
    IHttpResponse response =  httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12", response.getBlockingBody().readString());
    httpCon.close();
   
View Full Code Here

    httpCon.close();
   
    QAUtil.sleep(1000);
    con = pool.getNonBlockingConnection("localhost", server.getLocalPort());
    httpCon = new HttpClientConnection(con);
    response =  httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("12", response.getBlockingBody().readString());
    httpCon.close();
View Full Code Here

    for (int i = 0; i < 5; i++) {
     
      INonBlockingConnection con = pool.getNonBlockingConnection("localhost", server.getLocalPort());
      HttpClientConnection httpCon = new HttpClientConnection(con);
     
      IHttpResponse response =  httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/"));
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("12", response.getBlockingBody().readString());
    }
   
    QAUtil.sleep(1000);
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.