Package org.xlightweb.client

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



    IHttpClientEndpoint httpClient = new HttpClient();

    NonThreadedResponseHandler hdl = new NonThreadedResponseHandler();
    httpClient.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/"), hdl);

    while (hdl.getResponse() == null) {
        QAUtil.sleep(100);
    }
View Full Code Here



    IHttpClientEndpoint httpClient = new HttpClient();

    NonThreadedResponseHandler hdl = new NonThreadedResponseHandler();
    httpClient.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/"), hdl);

    while (hdl.getResponse() == null) {
        QAUtil.sleep(100);
    }
View Full Code Here


    IHttpClientEndpoint httpClient = new HttpClient();

    NonThreadedResponseHandler hdl = new NonThreadedResponseHandler();
    httpClient.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/"), hdl);

    QAUtil.sleep(500);

    IHttpResponse response = hdl.getResponse();
View Full Code Here


    IHttpClientEndpoint httpClient = new HttpClient();

    NonThreadedResponseHandler hdl = new NonThreadedResponseHandler();
    httpClient.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/"), hdl);

    while (hdl.getResponse() == null) {
        QAUtil.sleep(100);
    }
View Full Code Here

    RandomAccessFile raf = new RandomAccessFile(file, "r");
    FileChannel fc = raf.getChannel();
   
    System.out.println("call");
    FutureResponseHandler respHdl = new FutureResponseHandler();
    BodyDataSink bodyDataSink = httpClient.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/", "text/plain"), (int) fc.size(), respHdl);
    bodyDataSink.transferFrom(fc);
    bodyDataSink.close();
    fc.close();
    raf.close();
   
View Full Code Here

    byte[] data = "hello".getBytes("UTF-8");

    HttpRequestHeader header = new HttpRequestHeader("POST", "http://localhost:" +  server.getLocalPort() + "/");
    header.setContentType("text/plain; charset=UTF-8");

    BodyDataSink bodyDataSink = httpClient.send(header, data.length, hdl);
    bodyDataSink.write(data);
    bodyDataSink.close();

    IHttpResponse response = hdl.getResponse();
    String body = response.getBody().readString();
View Full Code Here

     
      public void onException(IOException ioe) {
      }
    };
   
    BodyDataSink bodyDataSink = httpClient.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/"), hdl);
    bodyDataSink.write(QAUtil.generateByteArray(10000));
    bodyDataSink.flush();
    bodyDataSink.write(QAUtil.generateByteArray(10000));

    server.close();
View Full Code Here

    int chunkSize = 100;
    int loops = 10;
   
    LOG.fine("send header");
    BodyDataSink bodyDataSink = httpClient.send(header, chunkSize * loops, hdl);

    for (int i = 0; i < loops; i++) {
        LOG.fine("write body data");
      bodyDataSink.write(QAUtil.generateByteBuffer(chunkSize));
    }
View Full Code Here


        int chunkSize = 100;
        int loops = 10;
       
        BodyDataSink bodyDataSink = httpClient.send(header, chunkSize * loops, hdl);

        for (int i = 0; i < loops; i++) {
            bodyDataSink.write(QAUtil.generateByteBuffer(chunkSize));
        }
       
View Full Code Here

    FutureResponseHandler hdl = new FutureResponseHandler();
    HttpRequestHeader header = new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort() + "/");
    header.setContentType("text/plain; charset=UTF-8");

    BodyDataSink bodyDataSink = httpClient.send(header, hdl);
    Assert.assertTrue("flushmode is not sync", bodyDataSink.getFlushmode() == FlushMode.SYNC);

    StringBuilder sb = new StringBuilder();

    for (int i = 0; i < 10; i++) {
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.