Package org.xlightweb.client

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


        Assert.assertNotNull(resp.getHeader("Location"));
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
        Assert.assertEquals(302, resp.getStatus());
        Assert.assertNotNull(resp.getHeader("Location"));
        Assert.assertTrue(resp.getHeader(CacheHandler.XHEADER_NAME).startsWith("HIT"));
       
       
View Full Code Here


       
        HttpClient httpClient = new HttpClient();
        httpClient.setFollowsRedirectMode(FollowsRedirectMode.ALL);
        httpClient.setCacheMaxSizeKB(100);
       
        IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
        Assert.assertEquals(200, resp.getStatus());
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
View Full Code Here

        IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
        Assert.assertEquals(200, resp.getStatus());
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertTrue(resp.getHeader(CacheHandler.XHEADER_NAME).startsWith("HIT"));
       
        Assert.assertEquals(2, httpClient.getNumCacheHit());
        Assert.assertEquals(2, httpClient.getNumCacheMiss());
View Full Code Here

        server.start();
       
        HttpClient httpClient = new HttpClient();
        httpClient.setCacheMaxSizeKB(100);
       
        IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
        Assert.assertEquals(303, resp.getStatus());
        Assert.assertNotNull(resp.getHeader("Location"));
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
View Full Code Here

        Assert.assertNotNull(resp.getHeader("Location"));
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
        Assert.assertEquals(303, resp.getStatus());
        Assert.assertNotNull(resp.getHeader("Location"));
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
       
View Full Code Here

        server.start();
       
        HttpClient httpClient = new HttpClient();
        httpClient.setCacheMaxSizeKB(100);
       
        IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
        Assert.assertEquals(302, resp.getStatus());
        Assert.assertNotNull(resp.getHeader("Location"));
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
View Full Code Here

        Assert.assertNotNull(resp.getHeader("Location"));
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
        Assert.assertEquals(302, resp.getStatus());
        Assert.assertNotNull(resp.getHeader("Location"));
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
       
       
View Full Code Here

        HttpServer server = new HttpServer(new MixedRequestHandler());
        server.start();
       
        HttpClient httpClient = new HttpClient();
       
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().toString());
       
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort());
View Full Code Here

    HttpClient httpClient = new HttpClient();

    String txt = "Test now return \n another at the end\n";
    PostRequest request = new PostRequest("http://localhost:" + container.getLocalPort() + "/");
    request.setParameter("\r\ntest ", txt);
    IHttpResponse response = httpClient.call(request);

    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals(txt, response.getBody().readString());
   
    httpClient.close();
View Full Code Here

        HttpClient httpClient = new HttpClient();

        String txt = "Test now return \n another at the end\n";
        IHttpRequest request = new FormURLEncodedRequest("http://localhost:" + container.getLocalPort() + "/");
        request.setParameter("\r\ntest ", txt);
        IHttpResponse response = httpClient.call(request);

        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals(txt, response.getBody().readString());
       
        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.