geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r568804 - /geronimo/sandbox/AsyncHttpClient/src/test/java/org/apache/ahc/ChunkedTest.java
Date Thu, 23 Aug 2007 01:58:56 GMT
Author: jgenender
Date: Wed Aug 22 18:58:55 2007
New Revision: 568804

URL: http://svn.apache.org/viewvc?rev=568804&view=rev
Log:
Test chunking continue 100

Modified:
    geronimo/sandbox/AsyncHttpClient/src/test/java/org/apache/ahc/ChunkedTest.java

Modified: geronimo/sandbox/AsyncHttpClient/src/test/java/org/apache/ahc/ChunkedTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/test/java/org/apache/ahc/ChunkedTest.java?rev=568804&r1=568803&r2=568804&view=diff
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/test/java/org/apache/ahc/ChunkedTest.java (original)
+++ geronimo/sandbox/AsyncHttpClient/src/test/java/org/apache/ahc/ChunkedTest.java Wed Aug
22 18:58:55 2007
@@ -45,6 +45,12 @@
                     "another-footer: another-value\r\n\r\n";
 
 
+    private final static String fakeHttpContinue =
+            "HTTP/1.1 100 Continue\r\n" +
+                    "Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n" +
+                    "Content-Type: text/plain\r\n" +
+                    "\r\n" + fakeHttp;
+
     public void testChunking() throws Exception{
         ByteBuffer buffer = ByteBuffer.allocate(fakeHttp.length());
         buffer.put(fakeHttp.getBytes());
@@ -55,6 +61,20 @@
         FakeProtocolDecoderOutput out = new FakeProtocolDecoderOutput();
         decoder.decode(session, buffer, out);
         
+        HttpResponseMessage response = (HttpResponseMessage) out.getObject();
+        assertTrue(Arrays.equals(response.getContent(), "abcdefghijklmnopqrstuvwxyz1234567890abcdef".getBytes()));
+    }
+
+    public void testChunkingContinue() throws Exception{
+        ByteBuffer buffer = ByteBuffer.allocate(fakeHttpContinue.length());
+        buffer.put(fakeHttp.getBytes());
+        buffer.flip();
+
+        IoSession session = new FakeIoSession();
+        HttpResponseDecoder decoder = new HttpResponseDecoder();
+        FakeProtocolDecoderOutput out = new FakeProtocolDecoderOutput();
+        decoder.decode(session, buffer, out);
+
         HttpResponseMessage response = (HttpResponseMessage) out.getObject();
         assertTrue(Arrays.equals(response.getContent(), "abcdefghijklmnopqrstuvwxyz1234567890abcdef".getBytes()));
     }



Mime
View raw message