Package org.apache.http

Examples of org.apache.http.StatusLine


                        " failed to respond with a valid HTTP response");
            }
            count++;
        } while(true);
        //create the status line from the status string
        StatusLine statusline = StatusLine.parse(this.buffer, 0, this.buffer.length());
        HttpResponse response = this.responsefactory.newHttpResponse(statusline);
        response.getParams().setDefaults(params);
        return response;
    }
View Full Code Here


    public void testNoContentLengthResponseHttp1_0() throws Exception {
        BasicHttpEntity entity = new BasicHttpEntity();
        entity.setChunked(false);
        entity.setContentLength(-1);
        StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);
        response.setEntity(entity);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertFalse(s.keepAlive(response));
View Full Code Here

    public void testNoContentLengthResponseHttp1_1() throws Exception {
        BasicHttpEntity entity = new BasicHttpEntity();
        entity.setChunked(false);
        entity.setContentLength(-1);
        StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);
        response.setEntity(entity);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertFalse(s.keepAlive(response));
View Full Code Here

    public void testChunkedContent() throws Exception {
        BasicHttpEntity entity = new BasicHttpEntity();
        entity.setChunked(true);
        entity.setContentLength(-1);
        StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);
        response.setEntity(entity);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertTrue(s.keepAlive(response));
View Full Code Here

    public void testIgnoreInvalidKeepAlive() throws Exception {
        BasicHttpEntity entity = new BasicHttpEntity();
        entity.setChunked(false);
        entity.setContentLength(-1);
        StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);
        response.addHeader(new Header("Connection", "keep-alive"));
        response.setEntity(entity);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
View Full Code Here

    public void testExplicitClose() throws Exception {
        BasicHttpEntity entity = new BasicHttpEntity();
        entity.setChunked(true);
        entity.setContentLength(-1);
        // Use HTTP 1.1
        StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);
        response.addHeader(new Header("Connection", "close"));
        response.setEntity(entity);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
View Full Code Here

    public void testExplicitKeepAlive() throws Exception {
        BasicHttpEntity entity = new BasicHttpEntity();
        entity.setChunked(false);
        entity.setContentLength(10);
        // Use HTTP 1.0
        StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);
        response.addHeader(new Header("Connection", "keep-alive"));
        response.setEntity(entity);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
View Full Code Here

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertTrue(s.keepAlive(response));
    }

    public void testHTTP10Default() throws Exception {
        StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertFalse(s.keepAlive(response));
    }
View Full Code Here

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertFalse(s.keepAlive(response));
    }
   
    public void testHTTP11Default() throws Exception {
        StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertTrue(s.keepAlive(response));
    }
View Full Code Here

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertTrue(s.keepAlive(response));
    }

    public void testFutureHTTP() throws Exception {
        StatusLine statusline = new StatusLine(new HttpVersion(3, 45), 200, "OK");
        HttpResponse response = new BasicHttpResponse(statusline);

        ConnectionReuseStrategy s = new DefaultConnectionReuseStrategy();
        assertTrue(s.keepAlive(response));
    }
View Full Code Here

TOP

Related Classes of org.apache.http.StatusLine

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.