Package org.xlightweb.client

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


      server.start();
     
      HttpClient httpClient = new HttpClient();
     
      GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
      IHttpResponse response = httpClient.call(request);
      Assert.assertEquals(200, response.getStatus());
     
      request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
      response = httpClient.call(request);
      Assert.assertEquals(200, response.getStatus());
View Full Code Here


      GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
      IHttpResponse response = httpClient.call(request);
      Assert.assertEquals(200, response.getStatus());
     
      request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
      response = httpClient.call(request);
      Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("JSESSIONID=1", request.getHeader("Cookie"));
     
        request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
        response = httpClient.call(request);
View Full Code Here

      response = httpClient.call(request);
      Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("JSESSIONID=1", request.getHeader("Cookie"));
     
        request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
        response = httpClient.call(request);
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("JSESSIONID=2", request.getHeader("Cookie"));

        request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
        response = httpClient.call(request);
View Full Code Here

        response = httpClient.call(request);
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("JSESSIONID=2", request.getHeader("Cookie"));

        request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
        response = httpClient.call(request);
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("JSESSIONID=3", request.getHeader("Cookie"));

       
      httpClient.close();
View Full Code Here

   
    IServer server = new HttpServer(new RequestHandler());
    server.start();
   
    HttpClient httpClient = new HttpClient();
    IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
    BodyDataSource body = resp.getBody();
   
    body.markReadPosition();
    Assert.assertEquals("line one", body.readStringByDelimiter("\r\n"));
   
View Full Code Here

        HttpClient client = new HttpClient();
       
        GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/Events");
        request.setHeader("Accept", "text/event-stream");
       
        IHttpResponse response = client.call(request);
        BodyDataSource body = response.getBody();
       
        Assert.assertEquals(200, response.getStatus());
       
        Event event = Event.parse(body.readStringByDelimiter("\r\n\r\n"));
View Full Code Here

        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);
View Full Code Here

        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

        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);
View Full Code Here

        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

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.