commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oglu...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestStreams.java
Date Wed, 16 Oct 2002 13:11:35 GMT
oglueck     2002/10/16 06:11:35

  Modified:    httpclient/src/test/org/apache/commons/httpclient
                        TestStreams.java
  Log:
  Added test case showing a problem with empty chunked streams.
  
  Revision  Changes    Path
  1.4       +14 -0     jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestStreams.java
  
  Index: TestStreams.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestStreams.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestStreams.java	26 Sep 2002 12:40:33 -0000	1.3
  +++ TestStreams.java	16 Oct 2002 13:11:35 -0000	1.4
  @@ -67,6 +67,20 @@
           }
       }
   
  +    public void testEmptyChunkedInputStream() throws IOException {
  +        String input = "0\r\n";
  +        HttpMethod method = new SimpleHttpMethod();
  +
  +        InputStream in = new ChunkedInputStream(new ByteArrayInputStream(input.getBytes()),
method);
  +        byte[] buffer = new byte[300];
  +        ByteArrayOutputStream out = new ByteArrayOutputStream();
  +        int len;
  +        while ((len = in.read(buffer)) > 0) {
  +            out.write(buffer, 0, len);
  +        }
  +        assertEquals(0, out.size());
  +    }
  +
       public void testContentLengthInputStream() throws IOException {
           String correct = "1234567890123456";
           InputStream in = new ContentLengthInputStream(new ByteArrayInputStream(correct.getBytes()),
10);
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message