@@ -0,0 +1,1917 @@
+package org.jboss.netty.handler.codec.http;%0A%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.junit.Assert.fail;%0A%0Aimport org.jboss.netty.buffer.ChannelBuffer;%0Aimport org.jboss.netty.buffer.ChannelBuffers;%0Aimport org.jboss.netty.handler.codec.PrematureChannelClosureException;%0Aimport org.jboss.netty.handler.codec.embedder.CodecEmbedderException;%0Aimport org.jboss.netty.handler.codec.embedder.DecoderEmbedder;%0Aimport org.jboss.netty.handler.codec.embedder.EncoderEmbedder;%0Aimport org.jboss.netty.util.CharsetUtil;%0Aimport org.junit.Test;%0A%0Apublic class HttpClientCodecTest %7B%0A%0A    private static final String RESPONSE = %22HTTP/1.0 200 OK%5Cr%5Cn%22 + %22Date: Fri, 31 Dec 1999 23:59:59 GMT%5Cr%5Cn%22 + %22Content-Type: text/html%5Cr%5Cn%22 + %22Content-Length: 28%5Cr%5Cn%22 + %22%5Cr%5Cn%22%0A            + %22%3Chtml%3E%3Cbody%3E%3C/body%3E%3C/html%3E%5Cr%5Cn%22;%0A%0A    @Test%0A    public void testFailsNotOnRequestResponse() %7B%0A        HttpClientCodec codec = new HttpClientCodec();%0A        DecoderEmbedder%3CChannelBuffer%3E decoder = new DecoderEmbedder%3CChannelBuffer%3E(codec);%0A        EncoderEmbedder%3CChannelBuffer%3E encoder = new EncoderEmbedder%3CChannelBuffer%3E(codec);%0A        %0A        encoder.offer(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, %22http://localhost/%22));%0A        decoder.offer(ChannelBuffers.copiedBuffer(RESPONSE, CharsetUtil.ISO_8859_1));%0A%0A        encoder.finish();%0A        decoder.finish();%0A   %0A    %7D%0A    %0A    @Test%0A    public void testFailsOnMissingResponse() %7B%0A        HttpClientCodec codec = new HttpClientCodec();%0A        EncoderEmbedder%3CChannelBuffer%3E encoder = new EncoderEmbedder%3CChannelBuffer%3E(codec);%0A        %0A        encoder.offer(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, %22http://localhost/%22));%0A%0A        try %7B%0A            encoder.finish();%0A            fail();%0A        %7D catch (CodecEmbedderException e) %7B%0A            assertTrue(e.getCause() instanceof PrematureChannelClosureException);%0A        %7D%0A        %0A    %7D%0A%7D%0A

Add test for HttpClientCodec that tests handling of missing responses. See #256 amd #259