Package org.xlightweb.client

Examples of org.xlightweb.client.HttpClientConnection$IBodySinkPair


       
        Server server = new Server(dh);
        server.start();
       
       
        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 server = new Server(dh);
        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.getBlockingBody().readString());
       
        server.close();
    }
View Full Code Here

     
      Server server = new Server(dh);
      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());
        Assert.assertEquals("12345", response.getBody().readString());

     
      con.close();
      server.close();
  }
View Full Code Here

       
        Server server = new Server(dh);
        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();
       
        BodyDataHandler dataHandler = new BodyDataHandler();
        dataSource.setDataHandler(dataHandler);
       
        QAUtil.sleep(500);
        Assert.assertNull(dataHandler.exceptionRef.get());
        Assert.assertEquals("123", dataHandler.dataRef.get());
               
        dataSource.close();
        QAUtil.sleep(500);
        Assert.assertFalse(con.isOpen());
       
        QAUtil.sleep(500);
        Assert.assertNotNull(dataHandler.exceptionRef.get());
       
        server.close();
View Full Code Here

       
        Server server = new Server(dh);
        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();
       
        BodyDataHandler dataHandler = new BodyDataHandler();
        dataSource.setDataHandler(dataHandler);
       
        QAUtil.sleep(1000);
        Assert.assertNull(dataHandler.exceptionRef.get());
        Assert.assertEquals("123", dataHandler.dataRef.get());
               
        dataSource.destroy();
        Assert.assertFalse(con.isOpen());
       
        QAUtil.sleep(1000);
        Assert.assertNotNull(dataHandler.exceptionRef.get());
       
        server.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());
        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();
        server.stop();
    }
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());
        Assert.assertEquals(sb.toString(), body);
       
        con.close();
        server.stop();
    }
View Full Code Here

       
        Server server = new Server(dh);
        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();
        server.close();
    }
View Full Code Here

       
        Server server = new Server(dh);
        server.start();
       
       
        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) {  }
       
        con.close();
        server.close();
  }
View Full Code Here

       
        Server server = new Server(dh);
        server.start();
       
       
        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

TOP

Related Classes of org.xlightweb.client.HttpClientConnection$IBodySinkPair

Copyright © 2018 www.massapicom. 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.