You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by je...@apache.org on 2015/04/12 23:52:35 UTC

[2/8] mina git commit: Multiple HTTP2 PDUs

http://git-wip-us.apache.org/repos/asf/mina/blob/27938fb1/http2/src/test/java/org/apache/mina/http2/api/Htp2PushPromiseFrameDecoderTest.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/api/Htp2PushPromiseFrameDecoderTest.java b/http2/src/test/java/org/apache/mina/http2/api/Htp2PushPromiseFrameDecoderTest.java
index 30b7299..02f7198 100644
--- a/http2/src/test/java/org/apache/mina/http2/api/Htp2PushPromiseFrameDecoderTest.java
+++ b/http2/src/test/java/org/apache/mina/http2/api/Htp2PushPromiseFrameDecoderTest.java
@@ -11,10 +11,10 @@ import org.junit.Test;
 public class Htp2PushPromiseFrameDecoderTest {
 
     @Test
-    public void checkHeadersFrameWithNotPadding() {
+    public void checkWithNoPadding() {
         Http2Connection connection = new Http2Connection();
         ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x05, /*length*/
-                                                        0x01, /*type*/
+                                                        0x05, /*type*/
                                                         0x00, /*flags*/
                                                         0x00, 0x00, 0x00, 0x01, /*streamID*/
                                                         0x00, 0x00, 0x01, 0x00, /*promisedStreamID*/
@@ -32,49 +32,26 @@ public class Htp2PushPromiseFrameDecoderTest {
     
     
     @Test
-    public void checkHeadersFramePaddingPriority() {
+    public void checkWithPadding() {
         Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x17, /*length*/
-                                                        0x01, /*type*/
-                                                        0x28, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x03, /*streamID*/
-                                                        0x10, /*padding length*/
-                                                        (byte)0x0080, 0x00, 0x00, 0x14, /*stream dependency*/
-                                                        0x09, /*weight*/
-                                                        (byte) 0x0082, /*headerFragment*/
-                                                        0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E /*padding*/});
-        Http2HeadersFrame frame = (Http2HeadersFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(23, frame.getLength());
-        assertEquals(1, frame.getType());
-        assertEquals(0x28, frame.getFlags());
-        assertEquals(3, frame.getStreamID());
-        assertEquals(10,  frame.getWeight());
-        assertEquals(1, frame.getHeaderBlockFragment().length);
-        assertEquals(0x0082, frame.getHeaderBlockFragment()[0] & 0x00FF);
-        assertEquals(16,  frame.getPadding().length);
-        assertArrayEquals(new byte[] {0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E}, frame.getPadding());
-    }
-    
-    @Test
-    public void checkHeadersFramePaddingNoPriority() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x12, /*length*/
-                                                        0x01, /*type*/
+        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x16, /*length*/
+                                                        0x05, /*type*/
                                                         0x08, /*flags*/
                                                         0x00, 0x00, 0x00, 0x03, /*streamID*/
                                                         0x10, /*padding length*/
+                                                        0x00, 0x00, 0x00, 0x14, /*promisedStreamID*/
                                                         (byte) 0x0082, /*headerFragment*/
                                                         0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E /*padding*/});
-        Http2HeadersFrame frame = (Http2HeadersFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(18, frame.getLength());
-        assertEquals(1, frame.getType());
+        Http2PushPromiseFrame frame = (Http2PushPromiseFrame) connection.decode(buffer);
+        assertEquals(22, frame.getLength());
+        assertEquals(5, frame.getType());
         assertEquals(0x08, frame.getFlags());
         assertEquals(3, frame.getStreamID());
+        assertEquals(20, frame.getPromisedStreamID());
         assertEquals(1, frame.getHeaderBlockFragment().length);
         assertEquals(0x0082, frame.getHeaderBlockFragment()[0] & 0x00FF);
         assertEquals(16,  frame.getPadding().length);
         assertArrayEquals(new byte[] {0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E}, frame.getPadding());
     }
+    
 }

http://git-wip-us.apache.org/repos/asf/mina/blob/27938fb1/http2/src/test/java/org/apache/mina/http2/api/Http2FrameHeaderPartialDecoderTest.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/api/Http2FrameHeaderPartialDecoderTest.java b/http2/src/test/java/org/apache/mina/http2/api/Http2FrameHeaderPartialDecoderTest.java
index bda0c77..af684b4 100644
--- a/http2/src/test/java/org/apache/mina/http2/api/Http2FrameHeaderPartialDecoderTest.java
+++ b/http2/src/test/java/org/apache/mina/http2/api/Http2FrameHeaderPartialDecoderTest.java
@@ -58,8 +58,6 @@ public class Http2FrameHeaderPartialDecoderTest {
         assertEquals(0, header.getType());
         assertEquals(0, header.getFlags());
         assertEquals(1, header.getStreamID());
-        assertEquals(1, header.getPayload().length);
-        assertEquals(0x40, header.getPayload()[0]       );
     }
 
 }