Code example for HttpMessage

Methods: addHeader, getParams

0
    } 
 
    public void testEntityWithInvalidChunkEncodingAndHTTP10() throws Exception { 
        SessionOutputBuffer datatransmitter = new SessionOutputBufferMockup(); 
        HttpMessage message = new HttpMessageMockup(); 
        message.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, 
                HttpVersion.HTTP_1_0); 
        message.addHeader("Transfer-Encoding", "chunked"); 
 
        EntitySerializer entitywriter = new EntitySerializer( 
                new StrictContentLengthStrategy()); 
        try { 
            entitywriter.doSerialize(datatransmitter, message); 
            fail("ProtocolException should have been thrown"); 
        } catch (ProtocolException ex) { 
            // expected 
        } 
    } 
 
    public void testEntityWithContentLength() throws Exception { 
        SessionOutputBuffer datatransmitter = new SessionOutputBufferMockup();