Package org.xlightweb

Examples of org.xlightweb.IHttpResponse


          ConnectionUtils.registerMBean(server);
         
          HttpClient httpClient = new HttpClient();

          IHttpResponse response = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort() + "/s/", new NameValuePair("param", "value"), new NameValuePair("param2", "value2")));
          Assert.assertEquals(200, response.getStatus());

          QAUtil.sleep(1000);

         
          Assert.assertEquals(0, (int) server.getTransactionsPending());
View Full Code Here


        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("[" + getId() + "] no handler found (for requested resource). returning error message");
        }
       
        try {
            IHttpResponse response = new HttpResponse(404, "text/html", generateErrorMessageHtml(404, null, getId()));
            callResponseHandler(responseHandler, response);
        } catch (IOException ioe) {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("[" + getId() + "] could not send not handle response. " + ioe.toString());
            }
View Full Code Here

        long elapsed = System.currentTimeMillis() - start;
        System.out.println("elapsed " + elapsed);

        Assert.assertTrue(elapsed < 2000);

        IHttpResponse response = respHdl.getResponse();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertFalse(response.getNonBlockingBody().isCompleteReceived());
       
        con.close();
        server.close();
    }
View Full Code Here

        long elapsed = System.currentTimeMillis() - start;
        System.out.println("elapsed " + elapsed);

        Assert.assertTrue(elapsed >= 2000);

        IHttpResponse response = respHdl.getResponse();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertTrue(response.getNonBlockingBody().isCompleteReceived());
       
        con.close();
        server.close();
    }
View Full Code Here

        long elapsed = System.currentTimeMillis() - start;
        System.out.println("elapsed " + elapsed);

        Assert.assertTrue(elapsed >= 2000);

        IHttpResponse response = respHdl.getResponse();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertTrue(response.getNonBlockingBody().isCompleteReceived());
       
        httpClient.close();
        server.close();
    }
View Full Code Here

     
    private void sendNotHandledError(final IHttpResponseHandler responseHandler) {
       
      try {
        final IHttpResponse response = new HttpResponse(404, "text/html", generateErrorMessageHtml(404, null, getId()));
   
        Runnable task = new Runnable() {
           
          public void run() {
            try {
View Full Code Here

        public BodyDataSink send(IHttpResponseHeader header) throws IOException, IllegalStateException {
           
            // return response to caller (request will not be send to remote endpoint)
            BodyDataSink dataSink = newInMemoryBodyDataSink(header.getCharacterEncoding(), executor);
           
            IHttpResponse response = new HttpResponse(header, getDataSourceOfInMemoryBodyDataSink(dataSink));
            send(response);
           
            return dataSink;
        }
View Full Code Here

        public BodyDataSink send(IHttpResponseHeader header, int contentLength) throws IOException, IllegalStateException {
           
            // return response to caller (request will not be send to remote endpoint)
            BodyDataSink dataSink = newInMemoryBodyDataSink(header.getCharacterEncoding(), executor);
           
            IHttpResponse response = new HttpResponse(header, getDataSourceOfInMemoryBodyDataSink(dataSink));
            send(response);
           
            return dataSink;
        }
View Full Code Here

      HttpClient httpClient = new HttpClient();
    httpClient.setProxyHost("localhost");
    httpClient.setProxyPort(proxy.getLocalPort());
   
    IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("OK", response.getBody().readString());
   
    QAUtil.sleep(500);
   
    response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());
       
        QAUtil.sleep(500);
        Assert.assertEquals(1, server.getNumHandledConnections())// connection should have been reused
   
    httpClient.close();
View Full Code Here

        HttpClient httpClient = new HttpClient(SSLTestContextFactory.getSSLContext());
        httpClient.setProxyHost("localhost");
        httpClient.setProxyPort(proxy.getLocalPort());
       
        IHttpResponse response = httpClient.call(new GetRequest("https://localhost:" + secServer.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());
       
        QAUtil.sleep(500);
       
        response = httpClient.call(new GetRequest("https://localhost:" + secServer.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().readString());
       
        QAUtil.sleep(500);
        Assert.assertEquals(1, secServer.getNumHandledConnections())// connection should have been reused
       
        httpClient.close();
View Full Code Here

TOP

Related Classes of org.xlightweb.IHttpResponse

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.