Package org.xlightweb.client

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


        server.start();
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());

        FutureResponseHandler hdl = new FutureResponseHandler();
        BodyDataSink ds = con.send(new HttpRequestHeader("POST", "http://localhost:"  +server.getLocalPort() + "/", "text/plain"), 200, hdl);
        for (int i = 0; i < 20; i++) {
            ds.write("0123456789");
            QAUtil.sleep(50);
        }
        ds.close();
View Full Code Here


        server.start();
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        FutureResponseHandler respHdl = new FutureResponseHandler();
        BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/"), respHdl);
       
        dataSink.write("test");
        QAUtil.sleep(200);
       
        dataSink.write("OneTwo");
View Full Code Here

        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        File file = QAUtil.createTestfile_4k();
       
        FutureResponseHandler respHdl = new FutureResponseHandler();
        BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/"), respHdl);
       
       
        RandomAccessFile raf = new RandomAccessFile(file, "r");
        FileChannel fc = raf.getChannel();
        dataSink.transferFrom(fc);
View Full Code Here

        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        File file = QAUtil.createTestfile_4k();
       
        FutureResponseHandler respHdl = new FutureResponseHandler();
        BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/"), respHdl);
       
       
        RandomAccessFile raf = new RandomAccessFile(file, "r");
        FileChannel fc = raf.getChannel();
        dataSink.transferFrom(fc);
View Full Code Here

       
        for (int i = 0; i < 100; i++) {
            HttpClientConnection con = pool.getHttpClientConnection("localhost", container.getLocalPort());
           
            FutureResponseHandler respHdl = new FutureResponseHandler();
            BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + container.getLocalPort() + "/test"), respHdl);
           
            dataSink.write("test");
           
            IHttpResponse response = respHdl.getResponse();
            Assert.assertEquals(200, response.getStatus());
View Full Code Here

    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    con.setOption(IConnection.SO_RCVBUF, 64);
    con.suspendReceiving();

    FutureResponseHandler respHdl = new FutureResponseHandler();
    con.send(new GetRequest("/" + file.getName()), respHdl);

    QAUtil.sleep(1000);
    con.resumeReceiving();

   
View Full Code Here

       
        long start = System.currentTimeMillis();
       
       
        ResponseHandler respHdl = new ResponseHandler();
        con.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/test?delay=2000"), respHdl);
       
        while (respHdl.getResponse() == null) {
            QAUtil.sleep(100);
        }
       
View Full Code Here

       
        long start = System.currentTimeMillis();
       
       
        OnMesageResponseHandler respHdl = new OnMesageResponseHandler();
        con.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/test?delay=2000"), respHdl);
       
        while (respHdl.getResponse() == null) {
            QAUtil.sleep(100);
        }
       
View Full Code Here


        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        OnMesageResponseHandler respHdl = new OnMesageResponseHandler();
        con.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/test?delay=2000"), respHdl);
       
        while (respHdl.getException() == null) {
            QAUtil.sleep(100);
        }
       
View Full Code Here

   
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
   
    ResponseHandler respHdl = new ResponseHandler();
    con.send(new GetRequest("/"), respHdl);
   
    QAUtil.sleep(1000);
   
    Assert.assertNotNull(respHdl.getException());
   
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.