Package org.xlightweb.client

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


     
      HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
     
 
      FutureResponseHandler respHandler = new FutureResponseHandler();
      BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/?isSuspend=true&durationMillis=2000"), respHandler);
     
      StringBuilder sb = new StringBuilder();
     
      for (int i = 1; i < 2; i++) {
        String data = new String(QAUtil.generateByteArray(222000 * i));
 
View Full Code Here


       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
   
        FutureResponseHandler respHandler = new FutureResponseHandler();
        BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/?isSuspend=true&durationMillis=2000"), respHandler);
       
        StringBuilder sb = new StringBuilder();
       
        for (int i = 1; i < 20; i++) {
            String data = new String(QAUtil.generateByteArray(22 * i));
 
View Full Code Here

       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
   
        FutureResponseHandler respHandler = new FutureResponseHandler();
        BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/?isSuspend=true&durationMillis=2000"), respHandler);
       
        StringBuilder sb = new StringBuilder();
       
        for (int i = 1; i < 2; i++) {
            String data = new String(QAUtil.generateByteArray(222000 * i));
 
View Full Code Here

        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        File file = QAUtil.createTestfile_40k();
       
        FutureResponseHandler respHdl = new FutureResponseHandler();
        BodyDataSink dataSink = con.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/"), respHdl);
          
        RandomAccessFile raf = new RandomAccessFile(file, "r");
        AsyncWriter writer = new AsyncWriter(dataSink, raf);
        writer.onWritten(0);
       
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

    con.setConnectionTimeoutMillis(1000);
   
    ResponseHandler respHdl = new ResponseHandler();
    HttpRequestHeader reqHdr = new HttpRequestHeader("POST", "/");

    BodyDataSink bodyDataSink = con.send(reqHdr, respHdl);
    bodyDataSink.write("er");
   
    QAUtil.sleep(1500);
   
    Assert.assertEquals(1, respHdl.getCountSocketException());
View Full Code Here

    con.setConnectionTimeoutMillis(1000);
   
    ResponseHandler2 respHdl = new ResponseHandler2();
    HttpRequestHeader reqHdr = new HttpRequestHeader("POST", "/");

    BodyDataSink bodyDataSink = con.send(reqHdr, respHdl);
    bodyDataSink.write("er");
   
    QAUtil.sleep(2000);
   
    Assert.assertEquals(1, respHdl.getCountIOException());
View Full Code Here

   
    ResponseHandler respHdl = new ResponseHandler();
    HttpRequestHeader reqHdr = new HttpRequestHeader("GET", "/");
    reqHdr.setHeader("sleep-time", Integer.toString(1000));

    con.send(reqHdr, respHdl);
   
    QAUtil.sleep(1500);
   
    Assert.assertEquals(0, respHdl.getCountIOException());
    Assert.assertEquals(1, respHdl.getCountSocketException());
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.