Package org.xlightweb.client

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


        server.start();
       
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
       
        QAUtil.sleep(1000);
        NonBlockingBodyDataSource dataSource = response.getNonBlockingBody();
       
View Full Code Here


        WebContainer server = new WebContainer(servlet);
        server.start();
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBody().readString());
       
        response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
View Full Code Here

       
        IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBody().readString());
       
        response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBody().readString());

       
        con.close();
View Full Code Here

        WebContainer server = new WebContainer(servlet);
        server.start();
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));

        Assert.assertEquals(200, response.getStatus());
        String body = response.getBody().readString();
       
        Assert.assertEquals(sb.toString().length(), body.length());
View Full Code Here

        server.start();
       
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBody().readString());
       
       
        con.close();
View Full Code Here

       
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        try {
            IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
            Assert.assertEquals(200, response.getStatus());

            response.getBody().readString();
            Assert.fail("ProtocolException expected");
        } catch (ProtocolException expected) {  }
View Full Code Here

       
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        try {
            con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
            Assert.fail("ProtocolException expected");
        } catch (ProtocolException expected) { }
       
        server.close();
    }
View Full Code Here

       
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        try {
            con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        } catch (IOException expected) { }
       
        server.close();
    }
View Full Code Here

        server.start();
       
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("<ht", response.getBody().readString());
       
        server.close();
    }
View Full Code Here

        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        byte[] data = QAUtil.generateByteArray(400000);
        PostRequest request = new PostRequest("http://localhost:" + server.getLocalPort() + "/test", "text/plain", data);
       
        IHttpResponse response = con.call(request);
       
        Assert.assertNull(response.getAttribute("org.xlightweb.HttpClientConnection.100-continueReceived"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertArrayEquals(data, response.getBlockingBody().readBytes());
       
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.