Package org.xlightweb.client

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


        Server server = new Server(hdl);
        server.start();

        HttpClient httpClient = new HttpClient();
       
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/"));
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("iso-8859-1", response.getCharacterEncoding());
        Assert.assertFalse("Herzlichen Gl\u00FCckwunsch, Sie haben sich zur Reinigung des Aufzugs entschlossen.".equals(response.getBody().readString()));
       
View Full Code Here


        server.start();

        HttpClient httpClient = new HttpClient();
        httpClient.setResponseBodyDefaultEncoding("utf-8");
       
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/"));
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("utf-8", response.getCharacterEncoding());
        Assert.assertEquals("Herzlichen Gl\u00FCckwunsch, Sie haben sich zur Reinigung des Aufzugs entschlossen.", response.getBody().readString());
       
View Full Code Here

        server.start();

        HttpClient httpClient = new HttpClient();
        httpClient.setResponseBodyDefaultEncoding("utf-8");
       
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/"));
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("iso-8859-1", response.getCharacterEncoding());
        Assert.assertFalse("Herzlichen Gl\u00FCckwunsch, Sie haben sich zur Reinigung des Aufzugs entschlossen.".equals(response.getBody().readString()));
       
View Full Code Here

      HttpServer server = new HttpServer(new RequestHandler());
      server.start();
     
      HttpClient client = new HttpClient();
     
      IHttpResponse resp = client.call(new GetRequest("Http://localhost:" + server.getLocalPort() + "/"));
     
      BodyDataSource bodyDataSource = resp.getBody();

      for (int i = 0; i < 10000; i++) {
          String value = bodyDataSource.readStringByDelimiter("\r\n\r\n");
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() + "/test"));
            Assert.assertEquals(200, response.getStatus());
        }
    }
 
 
View Full Code Here

    RequestHandler rh = new RequestHandler();
    IServer server = new HttpServer(rh);
    server.start();
   
    HttpClient httpClient = new HttpClient();
    IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test/?param1=value1&param2=value2"));

    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("value1", rh.getRequest().getParameter("param1"));
    Assert.assertEquals("value2", rh.getRequest().getParameter("param2"));
   
View Full Code Here

    RequestHandler rh = new RequestHandler();
    IServer server = new HttpServer(rh);
    server.start();
   
    HttpClient httpClient = new HttpClient();
    IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test?test=12&test=two"));

    Assert.assertEquals(200, response.getStatus());
    List<String> values = Arrays.asList(rh.getRequest().getParameterValues("test"));
    Assert.assertTrue(values.contains("12"));
    Assert.assertTrue(values.contains("two"));
View Full Code Here

    RequestHandler rh = new RequestHandler();
    IServer server = new HttpServer(rh);
    server.start();
   
    HttpClient httpClient = new HttpClient();
    IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test/?param1=value1&param2="));

    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("value1", rh.getRequest().getParameter("param1"));
    Assert.assertEquals("", rh.getRequest().getParameter("param2"));
View Full Code Here

    RequestHandler rh = new RequestHandler();
    IServer server = new HttpServer(rh);
    server.start();
   
    HttpClient httpClient = new HttpClient();
    IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test/?param1=value1"));

    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("value1", rh.getRequest().getParameter("param1"));

    httpClient.close();
View Full Code Here

    RequestHandler rh = new RequestHandler();
    IServer server = new HttpServer(rh);
    server.start();
   
    HttpClient httpClient = new HttpClient();
    IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test/?param1="));

    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("", rh.getRequest().getParameter("param1"));

    httpClient.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.