Package org.apache.http.io

Examples of org.apache.http.io.HttpDataReceiver


            // expected
        }
    }
   
    public void testEntityWithMultipleContentLengthSomeWrong() throws Exception {
        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        // lenient mode
        message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
        message.addHeader(new Header("Content-Type", "unknown"));
View Full Code Here


            // expected
        }
    }
   
    public void testEntityWithMultipleContentLengthAllWrong() throws Exception {
        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        // lenient mode
        message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
        message.addHeader(new Header("Content-Type", "unknown"));
View Full Code Here

            // expected
        }
    }

    public void testEntityWithInvalidContentLength() throws Exception {
        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        // lenient mode
        message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
        message.addHeader(new Header("Content-Type", "unknown"));
View Full Code Here

            // expected
        }
    }

    public void testEntityNeitherContentLengthNorTransferEncoding() throws Exception {
        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        // lenient mode
        message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
        EntityDeserializer entitygen = new DefaultEntityDeserializer();
View Full Code Here

        assertFalse(instream instanceof ChunkedInputStream);
        assertTrue(instream instanceof HttpDataInputStream);
    }

    public void testEntityContentType() throws Exception {
        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        message.addHeader(new Header("Content-Type", "stuff"));
        EntityDeserializer entitygen = new DefaultEntityDeserializer();
        HttpEntity entity = entitygen.deserialize(datareceiver, message);
View Full Code Here

        assertNotNull(entity.getContentType());
        assertEquals("stuff", entity.getContentType().getValue());
    }

    public void testEntityContentEncoding() throws Exception {
        HttpDataReceiver datareceiver = new HttpDataReceiverMockup(new byte[] {'0'});
        HttpMessage message = new HttpMessageMockup();

        message.addHeader(new Header("Content-Encoding", "what not"));
        EntityDeserializer entitygen = new DefaultEntityDeserializer();
        HttpEntity entity = entitygen.deserialize(datareceiver, message);
View Full Code Here

    protected HttpDataReceiver createHttpDataReceiver(
            final Socket socket,
            int buffersize,
            final HttpParams params) throws IOException {
        HttpDataReceiver receiver = super.createHttpDataReceiver(
                socket,
                buffersize,
                params);
        if (WIRE_LOG.isDebugEnabled()) {
            receiver = new LoggingHttpDataReceiverDecorator(receiver, new Wire(WIRE_LOG));
View Full Code Here

        this.socket = socket;
       
        int buffersize = HttpConnectionParams.getSocketBufferSize(params);
        HttpDataTransmitter transmitter = new SocketHttpDataTransmitter(socket, buffersize);
        HttpDataReceiver receiver = new SocketHttpDataReceiver(socket, buffersize);
        transmitter.reset(params);
        receiver.reset(params);
       
        setHttpDataReceiver(receiver);
        setHttpDataTransmitter(transmitter);
        setMaxHeaderCount(params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1));
        setResponseFactory(new DefaultHttpResponseFactory());
View Full Code Here

        this.socket = socket;
       
        int buffersize = HttpConnectionParams.getSocketBufferSize(params);
        HttpDataTransmitter transmitter = new SocketHttpDataTransmitter(socket, buffersize);
        HttpDataReceiver receiver = new SocketHttpDataReceiver(socket, buffersize);
        transmitter.reset(params);
        receiver.reset(params);
       
        setHttpDataReceiver(receiver);
        setHttpDataTransmitter(transmitter);
        setMaxHeaderCount(params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1));
        setRequestFactory(new DefaultHttpRequestFactory());
View Full Code Here

            // expected
        }
    }

    public void testEntityWithTransferEncoding() throws Exception {
        HttpDataReceiver datareceiver = new HttpDataReceiverMockup("0\r\n", "US-ASCII");
        HttpMessage message = new HttpMessageMockup();
       
        // lenient mode
        message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
View Full Code Here

TOP

Related Classes of org.apache.http.io.HttpDataReceiver

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.