Package org.xlightweb.client

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


    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?filename=C%3A%5CDOKUME%7E1%5Cgrro%5CLOKALE%7E1%5CTemp%5CxSocketTest23878.html"));

    Assert.assertEquals(200, response.getStatus());
   
    String filename = rh.getRequest().getParameter("filename");
    Assert.assertEquals("C:\\DOKUME~1\\grro\\LOKALE~1\\Temp\\xSocketTest23878.html", filename);
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=&param2=2"));

    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("", rh.getRequest().getParameter("param1"));
    Assert.assertEquals("2", 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=&param2=2&param1=3"));

    Assert.assertEquals(200, response.getStatus());
    List<String> params = Arrays.asList(rh.getRequest().getParameterValues("param1"));
    Assert.assertTrue(params.contains(""));
    Assert.assertTrue(params.contains("3"));
View Full Code Here

        server.start();
       
        HttpClient httpClient = new HttpClient();
       
        MultivalueMap entity = new MultivalueMap("UTF-8", new NameValuePair("param1", ""), new NameValuePair("param2", " 2  "), new NameValuePair("param1", "3 "));
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test/?" + entity.toString()));

        Assert.assertEquals(200, response.getStatus());
        List<String> params = Arrays.asList(rh.getRequest().getParameterValues("param1"));
        Assert.assertTrue(params.contains(""));
        Assert.assertTrue(params.contains("3 "));
View Full Code Here

      HttpClient httpClient = new HttpClient();
    httpClient.setProxyHost("localhost");
    httpClient.setProxyPort(proxy.getLocalPort());
   
    IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("OK", response.getBody().readString());
   
    QAUtil.sleep(500);
   
View Full Code Here

    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("OK", response.getBody().readString());
   
    QAUtil.sleep(500);
   
    response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());
       
        QAUtil.sleep(500);
        Assert.assertEquals(1, server.getNumHandledConnections())// connection should have been reused
View Full Code Here

        HttpClient httpClient = new HttpClient(SSLTestContextFactory.getSSLContext());
        httpClient.setProxyHost("localhost");
        httpClient.setProxyPort(proxy.getLocalPort());
       
        IHttpResponse response = httpClient.call(new GetRequest("https://localhost:" + secServer.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());
       
        QAUtil.sleep(500);
       
View Full Code Here

        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());
       
        QAUtil.sleep(500);
       
        response = httpClient.call(new GetRequest("https://localhost:" + secServer.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());
       
        QAUtil.sleep(500);
        Assert.assertEquals(1, secServer.getNumHandledConnections())// connection should have been reused
View Full Code Here

        server.start();

        HttpClient httpClient = new HttpClient(SSLTestContextFactory.getSSLContext());
       
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());

        QAUtil.sleep(500);
       
View Full Code Here

        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());

        QAUtil.sleep(500);
       
        response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());

        QAUtil.sleep(500);
        Assert.assertEquals(1, server.getNumHandledConnections())// connection has been reused
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.