Package org.xlightweb.client

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


        HttpClient httpClient = new HttpClient();
        httpClient.setCacheMaxSizeKB(100);
       
        IHttpRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/");
        request.setHeader("If-None-Match", "\"23\"");
        IHttpResponse resp = httpClient.call(request);
        Assert.assertEquals(304, resp.getStatus());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
       
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));
        String lastModified = resp.getHeader("Last-Modified");
       
View Full Code Here

       
        QAUtil.sleep(1000);
       
        IHttpRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/");
        request.setHeader("If-Modified-Since", lastModified);
        resp = httpClient.call(request);
        Assert.assertEquals(304, resp.getStatus());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
       
View Full Code Here

        public void run() {

          running.incrementAndGet();
          try {
            for (int j = 0; j < 50; j++) {
              IHttpResponse response = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort() + "/", "text/plain", "test"));
              Assert.assertEquals(200, response.getStatus());
              Assert.assertEquals("test", response.getBody().readString());
            }
          } catch (Exception e) {
            errors.add(e.toString());
View Full Code Here

    ConnectionUtils.registerMBean(server);
   
    HttpClient httpClient = new HttpClient();

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

    QAUtil.sleep(1000);

   
View Full Code Here

          ConnectionUtils.registerMBean(server);
         
          HttpClient httpClient = new HttpClient();

          IHttpResponse response = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort() + "/s/", new NameValuePair("param", "value"), new NameValuePair("param2", "value2")));
          Assert.assertEquals(200, response.getStatus());

          QAUtil.sleep(1000);

         
View Full Code Here

   
    HttpClient httpClient = new HttpClient();

    for (int i = 0; i < 10; i++) {
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
       
        QAUtil.sleep(200);
      }
   
View Full Code Here

       
        HttpClient httpClient = new HttpClient();

        for (int i = 0; i < 10; i++) {
            IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
            Assert.assertEquals(200, response.getStatus());
           
            QAUtil.sleep(200);
        }
       
View Full Code Here

        File file2 = QAUtil.createTestfile_40k();
       
        req.addPart(name1, file1);
        req.addPart(name2, file2);
           
        IHttpResponse resp = httpClient.call(req);
       
        String body = resp.getBody().toString();
        Assert.assertTrue(body.contains("name=file4k"));
        Assert.assertTrue(body.contains("name=file40k"));
       
View Full Code Here

        File file2 = QAUtil.createTestfile_40k();
       
        req.addPart(name1, file1);
        req.addPart(name2, file2);
           
        IHttpResponse resp = httpClient.call(req);
       
        String body = resp.getBody().toString();
        Assert.assertTrue(body.contains("name=file4k"));
        Assert.assertTrue(body.contains("name=file40k"));
       
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.