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:39 UTC

[6/8] mina git commit: Complete low level HTTP2

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2FrameHeadePartialDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2FrameHeadePartialDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2FrameHeadePartialDecoder.java
new file mode 100644
index 0000000..41e8817
--- /dev/null
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2FrameHeadePartialDecoder.java
@@ -0,0 +1,123 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.mina.http2.impl;
+
+import java.nio.ByteBuffer;
+
+import static org.apache.mina.http2.api.Http2Constants.HTTP2_31BITS_MASK;
+
+/**
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class Http2FrameHeadePartialDecoder implements PartialDecoder<Http2FrameHeadePartialDecoder.Http2FrameHeader> {
+    public static class Http2FrameHeader {
+        private int length;
+        private short type;
+        private byte flags;
+        private int streamID;
+
+        public int getLength() {
+            return length;
+        }
+       
+        public void setLength(int length) {
+            this.length = length;
+        }
+        
+        public short getType() {
+            return type;
+        }
+        
+        public void setType(short type) {
+            this.type = type;
+        }
+        
+        public byte getFlags() {
+            return flags;
+        }
+        
+        public void setFlags(byte flags) {
+            this.flags = flags;
+        }
+        
+        public int getStreamID() {
+            return streamID;
+        }
+        
+        public void setStreamID(int streamID) {
+            this.streamID = streamID;
+        }
+    }
+    
+    private static enum State {
+        LENGTH,
+        TYPE_FLAGS,
+        STREAMID,
+        END
+    }
+    
+    private State state;
+    private PartialDecoder<?> decoder;
+    private Http2FrameHeader value;
+    
+    public Http2FrameHeadePartialDecoder() {
+        reset();
+    }
+    
+    public boolean consume(ByteBuffer buffer) {
+        while (buffer.hasRemaining() && state != State.END) {
+            if (decoder.consume(buffer)) {
+                switch (state) {
+                case LENGTH:
+                    value.setLength(((IntPartialDecoder)decoder).getValue().intValue());
+                    decoder = new BytePartialDecoder(2);
+                    state = State.TYPE_FLAGS;
+                    break;
+                case TYPE_FLAGS:
+                    value.setType(((BytePartialDecoder)decoder).getValue()[0]);
+                    value.setFlags(((BytePartialDecoder)decoder).getValue()[1]);
+                    decoder = new IntPartialDecoder(4);
+                    state = State.STREAMID;
+                    break;
+                case STREAMID:
+                    value.setStreamID(((IntPartialDecoder)decoder).getValue() & HTTP2_31BITS_MASK);
+                    state = State.END;
+                    break;
+                }
+            }
+        }
+        return state == State.END;
+    }
+    
+    public Http2FrameHeader getValue() {
+        return value;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.mina.http2.api.PartialDecoder#reset()
+     */
+    @Override
+    public void reset() {
+        state = State.LENGTH;
+        decoder = new IntPartialDecoder(3);
+        value = new Http2FrameHeader();
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2GoAwayFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2GoAwayFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2GoAwayFrameDecoder.java
index 86187b2..e00007f 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2GoAwayFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2GoAwayFrameDecoder.java
@@ -1,20 +1,34 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
 import java.nio.ByteBuffer;
 
-import org.apache.mina.http2.api.BytePartialDecoder;
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2GoAwayFrame.Builder;
-import org.apache.mina.http2.api.IntPartialDecoder;
-import org.apache.mina.http2.api.PartialDecoder;
+import org.apache.mina.http2.api.Http2GoAwayFrame.Http2GoAwayFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 import static org.apache.mina.http2.api.Http2Constants.HTTP2_31BITS_MASK;
+
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2GoAwayFrameDecoder extends Http2FrameDecoder {
 
@@ -28,7 +42,7 @@ public class Http2GoAwayFrameDecoder extends Http2FrameDecoder {
     
     private PartialDecoder<?> decoder;
     
-    private Builder builder = new Builder();
+    private Http2GoAwayFrameBuilder builder = new Http2GoAwayFrameBuilder();
     
     public Http2GoAwayFrameDecoder(Http2FrameHeader header) {
         super(header);
@@ -48,11 +62,11 @@ public class Http2GoAwayFrameDecoder extends Http2FrameDecoder {
                 if (decoder.consume(buffer)) {
                     builder.lastStreamID(((IntPartialDecoder)decoder).getValue() & HTTP2_31BITS_MASK);
                     state = State.CODE;
-                    decoder.reset();
+                    decoder = new LongPartialDecoder(4);
                 }
             case CODE:
                 if (decoder.consume(buffer)) {
-                    builder.errorCode(((IntPartialDecoder)decoder).getValue());
+                    builder.errorCode(((LongPartialDecoder)decoder).getValue());
                     if (getHeader().getLength() > 8) {
                         state = State.EXTRA;
                         decoder = new BytePartialDecoder(getHeader().getLength() - 8);

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2HeadersFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2HeadersFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2HeadersFrameDecoder.java
index 72a89c3..d1deb9d 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2HeadersFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2HeadersFrameDecoder.java
@@ -1,15 +1,28 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
 import java.nio.ByteBuffer;
 
-import org.apache.mina.http2.api.BytePartialDecoder;
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2HeadersFrame.Builder;
-import org.apache.mina.http2.api.IntPartialDecoder;
-import org.apache.mina.http2.api.PartialDecoder;
+import org.apache.mina.http2.api.Http2HeadersFrame.Http2HeadersFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 import static org.apache.mina.http2.api.Http2Constants.FLAGS_PADDING;
 import static org.apache.mina.http2.api.Http2Constants.FLAGS_PRIORITY;
@@ -17,8 +30,8 @@ import static org.apache.mina.http2.api.Http2Constants.HTTP2_31BITS_MASK;
 import static org.apache.mina.http2.api.Http2Constants.HTTP2_EXCLUSIVE_MASK;
 
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2HeadersFrameDecoder extends Http2FrameDecoder {
 
@@ -36,7 +49,7 @@ public class Http2HeadersFrameDecoder extends Http2FrameDecoder {
     
     private int padLength;
     
-    private Builder builder = new Builder();
+    private Http2HeadersFrameBuilder builder = new Http2HeadersFrameBuilder();
     
     public Http2HeadersFrameDecoder(Http2FrameHeader header) {
         super(header);

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2PingFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2PingFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2PingFrameDecoder.java
index 4098d49..c894c98 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2PingFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2PingFrameDecoder.java
@@ -1,34 +1,41 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
 import java.nio.ByteBuffer;
-import org.apache.mina.http2.api.BytePartialDecoder;
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2PingFrame.Builder;
+
+import org.apache.mina.http2.api.Http2PingFrame.Http2PingFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2PingFrameDecoder extends Http2FrameDecoder {
-
-    private static enum State {
-        DATA,
-        EXTRA
-    }
-    
-    private State state;
-    
     private BytePartialDecoder decoder;
     
-    private Builder builder = new Builder();
+    private Http2PingFrameBuilder builder = new Http2PingFrameBuilder();
     
     public Http2PingFrameDecoder(Http2FrameHeader header) {
         super(header);
-        decoder = new BytePartialDecoder(8);
-        state = State.DATA;
+        decoder = new BytePartialDecoder(header.getLength());
         initBuilder(builder);
     }
     
@@ -37,25 +44,9 @@ public class Http2PingFrameDecoder extends Http2FrameDecoder {
      */
     @Override
     public boolean consume(ByteBuffer buffer) {
-        while ((getValue() == null) && buffer.remaining() > 0) {
-            switch (state) {
-            case DATA:
-                if (decoder.consume(buffer)) {
-                    builder.data(decoder.getValue());
-                    if (getHeader().getLength() > 8) {
-                        state = State.EXTRA;
-                        decoder = new BytePartialDecoder(getHeader().getLength() - 8);
-                    } else {
-                        setValue(builder.build());
-                    }
-                }
-                break;
-            case EXTRA:
-                if (decoder.consume(buffer)) {
-                    setValue(builder.build());
-                }
-                break;
-            }
+        if (decoder.consume(buffer)) {
+            builder.data(decoder.getValue());
+            setValue(builder.build());
         }
         return getValue() != null;
     }

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2PriorityFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2PriorityFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2PriorityFrameDecoder.java
index 8fd1036..3dbdfd2 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2PriorityFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2PriorityFrameDecoder.java
@@ -1,22 +1,35 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
 import java.nio.ByteBuffer;
 
-import org.apache.mina.http2.api.BytePartialDecoder;
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2PriorityFrame.Builder;
-import org.apache.mina.http2.api.IntPartialDecoder;
-import org.apache.mina.http2.api.PartialDecoder;
+import org.apache.mina.http2.api.Http2PriorityFrame.Http2PriorityFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 import static org.apache.mina.http2.api.Http2Constants.HTTP2_31BITS_MASK;
 import static org.apache.mina.http2.api.Http2Constants.HTTP2_EXCLUSIVE_MASK;
 
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2PriorityFrameDecoder extends Http2FrameDecoder {
 
@@ -30,7 +43,7 @@ public class Http2PriorityFrameDecoder extends Http2FrameDecoder {
     
     private PartialDecoder<?> decoder;
     
-    private Builder builder = new Builder();
+    private Http2PriorityFrameBuilder builder = new Http2PriorityFrameBuilder();
     
     public Http2PriorityFrameDecoder(Http2FrameHeader header) {
         super(header);

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2ProtocolDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2ProtocolDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2ProtocolDecoder.java
deleted file mode 100644
index 8217166..0000000
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2ProtocolDecoder.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 
- */
-package org.apache.mina.http2.impl;
-
-import java.nio.ByteBuffer;
-
-import org.apache.mina.codec.ProtocolDecoder;
-import org.apache.mina.http2.api.Http2Frame;
-
-/**
- * @author jeffmaury
- *
- */
-public class Http2ProtocolDecoder implements ProtocolDecoder<ByteBuffer, Http2Frame, Http2Connection> {
-
-    @Override
-    public Http2Connection createDecoderState() {
-        return new Http2Connection();
-    }
-
-    @Override
-    public Http2Frame decode(ByteBuffer input, Http2Connection context) {
-        return context.decode(input);
-    }
-
-    @Override
-    public void finishDecode(Http2Connection context) {
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2PushPromiseFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2PushPromiseFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2PushPromiseFrameDecoder.java
index 34863ce..077e7da 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2PushPromiseFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2PushPromiseFrameDecoder.java
@@ -1,22 +1,35 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
 import java.nio.ByteBuffer;
 
-import org.apache.mina.http2.api.BytePartialDecoder;
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2PushPromiseFrame.Builder;
-import org.apache.mina.http2.api.IntPartialDecoder;
-import org.apache.mina.http2.api.PartialDecoder;
+import org.apache.mina.http2.api.Http2PushPromiseFrame.Http2PushPromiseFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 import static org.apache.mina.http2.api.Http2Constants.FLAGS_PADDING;
 import static org.apache.mina.http2.api.Http2Constants.HTTP2_31BITS_MASK;
 
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2PushPromiseFrameDecoder extends Http2FrameDecoder {
 
@@ -33,7 +46,7 @@ public class Http2PushPromiseFrameDecoder extends Http2FrameDecoder {
     
     private int padLength;
     
-    private Builder builder = new Builder();
+    private Http2PushPromiseFrameBuilder builder = new Http2PushPromiseFrameBuilder();
     
     public Http2PushPromiseFrameDecoder(Http2FrameHeader header) {
         super(header);

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2RstStreamFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2RstStreamFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2RstStreamFrameDecoder.java
index e16b0bc..f64175c 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2RstStreamFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2RstStreamFrameDecoder.java
@@ -1,22 +1,32 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
 import java.nio.ByteBuffer;
 
-import org.apache.mina.http2.api.BytePartialDecoder;
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2RstStreamFrame.Builder;
-import org.apache.mina.http2.api.IntPartialDecoder;
-import org.apache.mina.http2.api.LongPartialDecoder;
-import org.apache.mina.http2.api.PartialDecoder;
-
-import static org.apache.mina.http2.api.Http2Constants.HTTP2_31BITS_MASK;
+import org.apache.mina.http2.api.Http2RstStreamFrame.Http2RstStreamFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2RstStreamFrameDecoder extends Http2FrameDecoder {
 
@@ -29,7 +39,7 @@ public class Http2RstStreamFrameDecoder extends Http2FrameDecoder {
     
     private PartialDecoder<?> decoder;
     
-    private Builder builder = new Builder();
+    private Http2RstStreamFrameBuilder builder = new Http2RstStreamFrameBuilder();
     
     public Http2RstStreamFrameDecoder(Http2FrameHeader header) {
         super(header);

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2SettingsFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2SettingsFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2SettingsFrameDecoder.java
index 6213c66..ab3166b 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2SettingsFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2SettingsFrameDecoder.java
@@ -1,5 +1,21 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
@@ -7,14 +23,13 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2SettingsFrame.Builder;
 import org.apache.mina.http2.api.Http2Setting;
-import org.apache.mina.http2.api.LongPartialDecoder;
+import org.apache.mina.http2.api.Http2SettingsFrame.Http2SettingsFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2SettingsFrameDecoder extends Http2FrameDecoder {
 
@@ -22,7 +37,7 @@ public class Http2SettingsFrameDecoder extends Http2FrameDecoder {
     
     private LongPartialDecoder decoder = new LongPartialDecoder(6);
     
-    private Builder builder = new Builder();
+    private Http2SettingsFrameBuilder builder = new Http2SettingsFrameBuilder();
     
     private Collection<Http2Setting> settings = new ArrayList<Http2Setting>();
     
@@ -42,7 +57,7 @@ public class Http2SettingsFrameDecoder extends Http2FrameDecoder {
                 remaining--;
                 Http2Setting setting = new Http2Setting();
                 setting.setID((int) ((decoder.getValue() & 0x00FFFF00000000L) >> 32));
-                setting.setValue(decoder.getValue() & 0x00FFFFFFFFL);
+                setting.setValue((decoder.getValue() & 0x00FFFFFFFFL));
                 settings.add(setting);
                 decoder.reset();
                 if (remaining == 0) {

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2UnknownFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2UnknownFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2UnknownFrameDecoder.java
index f19e55f..df64cfc 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2UnknownFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2UnknownFrameDecoder.java
@@ -1,22 +1,38 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
 import java.nio.ByteBuffer;
-import org.apache.mina.http2.api.BytePartialDecoder;
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2UnknownFrame.Builder;
+
+import org.apache.mina.http2.api.Http2UnknownFrame.Http2UnknownFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2UnknownFrameDecoder extends Http2FrameDecoder {
 
     private BytePartialDecoder decoder;
     
-    private Builder builder = new Builder();
+    private Http2UnknownFrameBuilder builder = new Http2UnknownFrameBuilder();
     
     public Http2UnknownFrameDecoder(Http2FrameHeader header) {
         super(header);

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/Http2WindowUpdateFrameDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/Http2WindowUpdateFrameDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/Http2WindowUpdateFrameDecoder.java
index 6d96327..234db5c 100644
--- a/http2/src/main/java/org/apache/mina/http2/impl/Http2WindowUpdateFrameDecoder.java
+++ b/http2/src/main/java/org/apache/mina/http2/impl/Http2WindowUpdateFrameDecoder.java
@@ -1,19 +1,32 @@
-/**
- * 
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
  */
 package org.apache.mina.http2.impl;
 
 import java.nio.ByteBuffer;
 
-import org.apache.mina.http2.api.BytePartialDecoder;
-import org.apache.mina.http2.api.Http2FrameHeadePartialDecoder.Http2FrameHeader;
-import org.apache.mina.http2.api.Http2WindowUpdateFrame.Builder;
-import org.apache.mina.http2.api.IntPartialDecoder;
-import org.apache.mina.http2.api.PartialDecoder;
+import org.apache.mina.http2.api.Http2WindowUpdateFrame.Http2WindowUpdateFrameBuilder;
+import org.apache.mina.http2.impl.Http2FrameHeadePartialDecoder.Http2FrameHeader;
 
 /**
- * @author jeffmaury
- *
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class Http2WindowUpdateFrameDecoder extends Http2FrameDecoder {
 
@@ -26,7 +39,7 @@ public class Http2WindowUpdateFrameDecoder extends Http2FrameDecoder {
     
     private PartialDecoder<?> decoder;
     
-    private Builder builder = new Builder();
+    private Http2WindowUpdateFrameBuilder builder = new Http2WindowUpdateFrameBuilder();
     
     public Http2WindowUpdateFrameDecoder(Http2FrameHeader header) {
         super(header);

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/IntPartialDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/IntPartialDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/IntPartialDecoder.java
new file mode 100644
index 0000000..152d840
--- /dev/null
+++ b/http2/src/main/java/org/apache/mina/http2/impl/IntPartialDecoder.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.mina.http2.impl;
+
+import java.nio.ByteBuffer;
+
+/**
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class IntPartialDecoder implements PartialDecoder<Integer> {
+    private int size;
+    private int remaining;
+    private int value;
+    
+    /**
+     * Decode an integer whose size is different from the standard 4.
+     * 
+     * @param size the size (1,2,3,4) to decode
+     */
+    public IntPartialDecoder(int size) {
+        this.remaining = size;
+        this.size = size;
+    }
+
+    /**
+     * Decode a 4 bytes integer 
+     */
+    public IntPartialDecoder() {
+        this(4);
+    }
+    
+    public boolean consume(ByteBuffer buffer) {
+        if (remaining == 0) {
+            throw new IllegalStateException();
+        }
+        while (remaining > 0 && buffer.hasRemaining()) {
+            value = (value << 8) + (buffer.get() & 0x00FF);
+            --remaining;
+        }
+        return remaining == 0;
+    }
+    
+    public Integer getValue() {
+        if (remaining > 0) {
+            throw new IllegalStateException();
+        }
+        return value;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.mina.http2.api.PartialDecoder#reset()
+     */
+    @Override
+    public void reset() {
+        remaining = size;
+        value = 0;
+    }
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/LongPartialDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/LongPartialDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/LongPartialDecoder.java
new file mode 100644
index 0000000..e6ac6eb
--- /dev/null
+++ b/http2/src/main/java/org/apache/mina/http2/impl/LongPartialDecoder.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.mina.http2.impl;
+
+import java.nio.ByteBuffer;
+
+/**
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class LongPartialDecoder implements PartialDecoder<Long> {
+    private int size;
+    private int remaining;
+    private long value;
+    
+    /**
+     * Decode a long integer whose size is different from the standard 8.
+     * 
+     * @param size the size (1 to 8) to decode
+     */
+    public LongPartialDecoder(int size) {
+        this.remaining = size;
+        this.size = size;
+    }
+
+    /**
+     * Decode a 8 bytes long integer 
+     */
+    public LongPartialDecoder() {
+        this(8);
+    }
+    
+    public boolean consume(ByteBuffer buffer) {
+        if (remaining == 0) {
+            throw new IllegalStateException();
+        }
+        while (remaining > 0 && buffer.hasRemaining()) {
+            value = (value << 8) + (buffer.get() & 0x00FF);
+            --remaining;
+        }
+        return remaining == 0;
+    }
+    
+    public Long getValue() {
+        if (remaining > 0) {
+            throw new IllegalStateException();
+        }
+        return value;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.mina.http2.api.PartialDecoder#reset()
+     */
+    @Override
+    public void reset() {
+        remaining = size;
+        value = 0;
+    }
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/main/java/org/apache/mina/http2/impl/PartialDecoder.java
----------------------------------------------------------------------
diff --git a/http2/src/main/java/org/apache/mina/http2/impl/PartialDecoder.java b/http2/src/main/java/org/apache/mina/http2/impl/PartialDecoder.java
new file mode 100644
index 0000000..0139382
--- /dev/null
+++ b/http2/src/main/java/org/apache/mina/http2/impl/PartialDecoder.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.mina.http2.impl;
+
+import java.nio.ByteBuffer;
+
+/**
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface PartialDecoder<T> {
+    /**
+     * Consume the buffer so as to decode a value. Not all the input buffer
+     * may be consumed.
+     * 
+     * @param buffer the input buffer to decode
+     * @return true if a value is available false if more data is requested
+     */
+    public boolean consume(ByteBuffer buffer);
+    
+    /**
+     * Return the decoded value.
+     * 
+     * @return the decoded value
+     */
+    public T getValue();
+    
+    /**
+     * Reset the internal state of the decoder to that new decoding can take place.
+     */
+    public void reset();
+
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/test/java/org/apache/mina/http2/Http2Test.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/Http2Test.java b/http2/src/test/java/org/apache/mina/http2/Http2Test.java
new file mode 100644
index 0000000..44ee14b
--- /dev/null
+++ b/http2/src/test/java/org/apache/mina/http2/Http2Test.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.mina.http2;
+
+import java.nio.ByteBuffer;
+
+/**
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+
+public abstract class Http2Test {
+    protected byte[] toByteArray(ByteBuffer buffer) {
+        byte[] result = new byte[buffer.remaining()];
+        buffer.get(result);
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/test/java/org/apache/mina/http2/TestMessages.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/TestMessages.java b/http2/src/test/java/org/apache/mina/http2/TestMessages.java
new file mode 100644
index 0000000..c931603
--- /dev/null
+++ b/http2/src/test/java/org/apache/mina/http2/TestMessages.java
@@ -0,0 +1,465 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.mina.http2;
+
+import java.util.Collections;
+
+import org.apache.mina.http2.api.Http2ContinuationFrame;
+import org.apache.mina.http2.api.Http2ContinuationFrame.Http2ContinuationFrameBuilder;
+import org.apache.mina.http2.api.Http2DataFrame;
+import org.apache.mina.http2.api.Http2DataFrame.Http2DataFrameBuilder;
+import org.apache.mina.http2.api.Http2GoAwayFrame;
+import org.apache.mina.http2.api.Http2GoAwayFrame.Http2GoAwayFrameBuilder;
+import org.apache.mina.http2.api.Http2HeadersFrame;
+import org.apache.mina.http2.api.Http2HeadersFrame.Http2HeadersFrameBuilder;
+import org.apache.mina.http2.api.Http2PingFrame;
+import org.apache.mina.http2.api.Http2PingFrame.Http2PingFrameBuilder;
+import org.apache.mina.http2.api.Http2PriorityFrame;
+import org.apache.mina.http2.api.Http2PriorityFrame.Http2PriorityFrameBuilder;
+import org.apache.mina.http2.api.Http2PushPromiseFrame;
+import org.apache.mina.http2.api.Http2PushPromiseFrame.Http2PushPromiseFrameBuilder;
+import org.apache.mina.http2.api.Http2RstStreamFrame;
+import org.apache.mina.http2.api.Http2RstStreamFrame.Http2RstStreamFrameBuilder;
+import org.apache.mina.http2.api.Http2Setting;
+import org.apache.mina.http2.api.Http2SettingsFrame;
+import org.apache.mina.http2.api.Http2SettingsFrame.Http2SettingsFrameBuilder;
+import org.apache.mina.http2.api.Http2UnknownFrame;
+import org.apache.mina.http2.api.Http2UnknownFrame.Http2UnknownFrameBuilder;
+
+/**
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+
+public final class TestMessages {
+
+    public static final byte[] CONTINUATION_NO_HEADER_FRAGMENT_BUFFER = new byte[] {
+        0x00, 0x00, 0x00, /*length*/
+        0x09, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x32 /*streamID*/
+        };
+
+    public static final Http2ContinuationFrame CONTINUATION_NO_HEADER_FRAGMENT_FRAME = Http2ContinuationFrameBuilder.builder().
+            streamID(50).
+            build();
+    
+    public static final byte[] CONTINUATION_HEADER_FRAGMENT_BUFFER = new byte[] {
+        0x00, 0x00, 0x0A, /*length*/
+        0x09, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x32, /*streamID*/
+        0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A /*headerFragment*/
+        };
+    
+    public static final Http2ContinuationFrame CONTINUATION_HEADER_FRAGMENT_FRAME = Http2ContinuationFrameBuilder.builder().
+                streamID(50).
+                headerBlockFragment(new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A}).
+                build();
+    
+    public static final byte[] DATA_NO_PAYLOAD_NO_PADDING_BUFFER = new byte[] {
+        0x00, 0x00, 0x00, /*length*/
+        0x00, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x32 /*streamID*/
+        };
+    
+    public static final Http2DataFrame DATA_NO_PAYLOAD_NO_PADDING_FRAME = Http2DataFrameBuilder.builder().
+            streamID(50).
+            build();
+    
+    public static final byte[] DATA_PAYLOAD_NO_PADDING_BUFFER = new byte[] {
+        0x00, 0x00, 0x0A, /*length*/
+        0x00, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x32, /*streamID*/
+        0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A /*headerFragment*/
+        };
+    
+    public static final Http2DataFrame DATA_PAYLOAD_NO_PADDING_FRAME = Http2DataFrameBuilder.builder().
+            streamID(50).
+            data(new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A}).
+            build();
+    
+    public static final byte[] DATA_NO_PAYLOAD_PADDING_BUFFER = new byte[] {
+        0x00, 0x00, 0x03, /*length*/
+        0x00, /*type*/
+        0x08, /*flags*/
+        0x00, 0x00, 0x00, 0x32, /*streamID*/
+        0x02, /*padLength*/
+        0x0E, 0x28 /*padding*/
+        };
+    
+    public static final Http2DataFrame DATA_NO_PAYLOAD_PADDING_FRAME = Http2DataFrameBuilder.builder().
+            streamID(50).
+            padding(new byte[] {0x0E, 0x28}).
+            build();
+    
+    public static final byte[] DATA_PAYLOAD_PADDING_BUFFER = new byte[] {
+        0x00, 0x00, 0x0D, /*length*/
+        0x00, /*type*/
+        0x08, /*flags*/
+        0x00, 0x00, 0x00, 0x32, /*streamID*/
+        0x02, /*padLength*/
+        0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, /*data*/
+        0x0E, 0x28 /*padding*/
+        };
+    
+    public static final Http2DataFrame DATA_PAYLOAD_PADDING_FRAME = Http2DataFrameBuilder.builder().
+            streamID(50).
+            data(new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A}).
+            padding(new byte[] {0x0E, 0x28}).
+            build();
+    
+    public static final byte[] GOAWAY_NO_DATA_BUFFER = new byte[] {
+        0x00, 0x00, 0x08, /*length*/
+        0x07, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x01, /*streamID*/
+        0x00, 0x00, 0x01, 0x00, /*lastStreamID*/
+        0x00, 0x01, 0x02, 0x03 /*errorCode*/
+        };
+    
+    public static final Http2GoAwayFrame GOAWAY_NO_DATA_FRAME = Http2GoAwayFrameBuilder.builder().
+            streamID(1).
+            lastStreamID(256).
+            errorCode(0x010203).
+            build();
+    
+    public static final byte[] GOAWAY_NO_DATA_HIGHEST_STREAMID_BUFFER = new byte[] {
+        0x00, 0x00, 0x08, /*length*/
+        0x07, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x01, /*streamID*/
+        0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, /*lastStreamID*/
+        0x00, 0x01, 0x02, 0x03 /*errorCode*/
+        };
+    
+    public static final Http2GoAwayFrame GOAWAY_NO_DATA_HIGHEST_STREAMID_FRAME = Http2GoAwayFrameBuilder.builder().
+            streamID(1).
+            lastStreamID(0x7FFFFFFF).
+            errorCode(0x010203).
+            build();
+    
+    public static final byte[] GOAWAY_NO_DATA_HIGHEST_STREAMID_RESERVED_BIT_BUFFER = new byte[] {
+        0x00, 0x00, 0x08, /*length*/
+        0x07, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x01, /*streamID*/
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, /*lastStreamID*/
+        0x00, 0x01, 0x02, 0x03 /*errorCode*/
+        };
+    
+    public static final byte[] GOAWAY_NO_DATA_HIGHEST_ERROR_CODE_BUFFER = new byte[] {
+        0x00, 0x00, 0x08, /*length*/
+        0x07, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x01, /*streamID*/
+        (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, /*lastStreamID*/
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF /*errorCode*/
+        };
+    
+    public static final Http2GoAwayFrame GOAWAY_NO_DATA_HIGHEST_ERROR_CODE_FRAME = Http2GoAwayFrameBuilder.builder().
+            streamID(1).
+            lastStreamID(0x7FFFFFFF).
+            errorCode(0x00FFFFFFFFL).
+            build();
+    
+    public static final byte[] GOAWAY_DATA_BUFFER = new byte[] {
+        0x00, 0x00, 0x09, /*length*/
+        0x07, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x01, /*streamID*/
+        0x00, 0x00, 0x01, 0x00, /*lastStreamID*/
+        0x00, 0x01, 0x02, 0x03, /*errorCode*/
+        0x01 /*additionData*/
+        };
+    
+    public static final Http2GoAwayFrame GOAWAY_DATA_FRAME = Http2GoAwayFrameBuilder.builder().
+            streamID(1).
+            lastStreamID(256).
+            errorCode(0x010203).
+            data(new byte[] { 0x01}).
+            build();
+    
+    public static final byte[] HEADERS_NO_PADDING_NO_PRIORITY_BUFFER = new byte[] {
+        0x00, 0x00, 0x01, /*length*/
+        0x01, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x01, /*streamID*/
+        (byte) 0x82 /*headerFragment*/
+        };
+    
+    public static final Http2HeadersFrame HEADERS_NO_PADDING_NO_PRIORITY_FRAME = Http2HeadersFrameBuilder.builder().
+            streamID(1).
+            headerBlockFragment(new byte[] {(byte) 0x82}).
+            build();
+    
+    public static final byte[] HEADERS_PADDING_PRIORITY_BUFFER = 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) 0x82, /*headerFragment*/
+        0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E /*padding*/
+        };
+    
+    public static final Http2HeadersFrame HEADERS_PADDING_PRIORITY_FRAME = Http2HeadersFrameBuilder.builder().
+            streamID(3).
+            exclusiveMode(true).
+            streamDependencyID(20).
+            weight((short) 10).
+            headerBlockFragment(new byte[] { (byte) 0x82}).
+            padding(new byte[] {0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E}).
+            build();
+    
+    public static final byte[] HEADERS_PADDING_NO_PRIORITY_BUFFER = new byte[] {
+        0x00, 0x00, 0x12, /*length*/
+        0x01, /*type*/
+        0x08, /*flags*/
+        0x00, 0x00, 0x00, 0x03, /*streamID*/
+        0x10, /*padding length*/
+        (byte) 0x0082, /*headerFragment*/
+        0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E /*padding*/
+        };
+    
+    public static final Http2HeadersFrame HEADERS_PADDING_NO_PRIORITY_FRAME = Http2HeadersFrameBuilder.builder().
+            streamID(3).
+            headerBlockFragment(new byte[] { (byte) 0x82}).
+            padding(new byte[] {0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E}).
+            build();
+    
+    public static final byte[] PING_STANDARD_BUFFER = new byte[] {
+        0x00, 0x00, 0x08, /*length*/
+        0x06, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07/*opaqueData*/
+        };
+    
+    public static final Http2PingFrame PING_STANDARD_FRAME = Http2PingFrameBuilder.builder().
+            streamID(32).
+            data(new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}).
+            build();
+    
+    public static final byte[] PING_EXTRA_DATA_BUFFER = new byte[] {
+        0x00, 0x00, 0x09, /*length*/
+        0x06, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08/*opaqueData*/
+        };
+    
+    public static final Http2PingFrame PING_EXTRA_DATA_FRAME = Http2PingFrameBuilder.builder().
+            streamID(32).
+            data(new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}).
+            build();
+    
+    public static final byte[] PING_NO_ENOUGH_DATA_BUFFER = new byte[] {
+        0x00, 0x00, 0x01, /*length*/
+        0x06, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x00/*opaqueData*/
+        };
+    
+    public static final Http2PingFrame PING_NO_ENOUGH_DATA_FRAME = Http2PingFrameBuilder.builder().
+            streamID(32).
+            data(new byte[] {0x00}).
+            build();
+    
+    public static final byte[] PRIORITY_NO_EXCLUSIVE_MODE_BUFFER = new byte[] {
+        0x00, 0x00, 0x05, /*length*/
+        0x02, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x00, 0x00, 0x01, 0x00, /*streamDependency*/
+        0x01 /*weight*/
+        };
+    
+    public static final Http2PriorityFrame PRIORITY_NO_EXCLUSIVE_MODE_FRAME = Http2PriorityFrameBuilder.builder().
+            streamID(32).
+            weight((short) 2).
+            streamDependencyID(256).
+            build();
+    
+    public static final byte[] PRIORITY_EXCLUSIVE_MODE_BUFFER = new byte[] {
+        0x00, 0x00, 0x05, /*length*/
+        0x02, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        (byte) 0x80, 0x00, 0x01, 0x00, /*streamDependency*/
+        0x01 /*weight*/
+        };
+    
+    public static final Http2PriorityFrame PRIORITY_EXCLUSIVE_MODE_FRAME = Http2PriorityFrameBuilder.builder().
+            streamID(32).
+            weight((short) 2).
+            streamDependencyID(256).
+            exclusiveMode(true).
+            build();
+    
+    public static final byte[] PUSH_PROMISE_NO_PADDING_BUFFER = new byte[] {
+        0x00, 0x00, 0x05, /*length*/
+        0x05, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x01, /*streamID*/
+        0x00, 0x00, 0x01, 0x00, /*promisedStreamID*/
+        (byte) 0x82 /*headerFragment*/
+        };
+    
+    public static final Http2PushPromiseFrame PUSH_PROMISE_NO_PADDING_FRAME = Http2PushPromiseFrameBuilder.builder().
+            streamID(1).
+            promisedStreamID(256).
+            headerBlockFragment(new byte[] {(byte) 0x82}).
+            build();
+    
+    public static final byte[] PUSH_PROMISE_PADDING_BUFFER = 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*/
+        };
+    
+    public static final Http2PushPromiseFrame PUSH_PROMISE_PADDING_FRAME = Http2PushPromiseFrameBuilder.builder().
+            streamID(3).
+            promisedStreamID(20).
+            headerBlockFragment(new byte[] {(byte) 0x82}).
+            padding(new byte[] { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6E, 0x67, 0x2E}).
+            build();
+    
+    public static final byte[] RST_STREAM_NO_EXTRA_PAYLOAD_BUFFER = new byte[] {
+        0x00, 0x00, 0x04, /*length*/
+        0x03, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x00, 0x00, 0x01, 0x00, /*errorCode*/
+        };
+    
+    public static final Http2RstStreamFrame RST_STREAM_NO_EXTRA_PAYLOAD_FRAME = Http2RstStreamFrameBuilder.builder().
+            streamID(32).
+            errorCode(256).
+            build();
+    
+    public static final byte[] RST_STREAM_HIGHEST_VALUE_NO_EXTRA_PAYLOAD_BUFFER = new byte[] {0x00, 0x00, 0x04, /*length*/
+        0x03, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, /*errorCode*/
+        };
+    
+    public static final Http2RstStreamFrame RST_STREAM_HIGHEST_VALUE_NO_EXTRA_PAYLOAD_FRAME = Http2RstStreamFrameBuilder.builder().
+            streamID(32).
+            errorCode(0x00FFFFFFFFL).
+            build();
+
+    public static final byte[] RST_STREAM_EXTRA_PAYLOAD_BUFFER = new byte[] {
+        0x00, 0x00, 0x06, /*length*/
+        0x03, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x00, 0x00, 0x01, 0x00, /*errorCode*/
+        0x0E, 0x28
+        };
+   
+    public static final byte[] RST_STREAM_EXTRA_PAYLOAD_HIGHEST_BUFFER = new byte[] {
+        0x00, 0x00, 0x06, /*length*/
+        0x03, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, /*errorCode*/
+        0x0E, 0x28
+        };
+    
+    public static final byte[] SETTINGS_DEFAULT_BUFFER = new byte[] {
+        0x00, 0x00, 0x06, /*length*/
+        0x04, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x00, 0x01, /*ID*/
+        0x01, 0x02, 0x03, 0x04, /*value*/
+        };
+    
+    public static final Http2SettingsFrame SETTINGS_DEFAULT_FRAME = Http2SettingsFrameBuilder.builder().
+            streamID(32).
+            settings(Collections.singletonList(new Http2Setting(1, 0x01020304))).
+            build();
+    
+    public static final byte[] SETTINGS_HIGHEST_ID_BUFFER = new byte[] {
+        0x00, 0x00, 0x06, /*length*/
+        0x04, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        (byte) 0xFF, (byte) 0xFF, /*ID*/
+        0x01, 0x02, 0x03, 0x04, /*value*/
+        };
+    
+    public static final Http2SettingsFrame SETTINGS_HIGHEST_ID_FRAME = Http2SettingsFrameBuilder.builder().
+            streamID(32).
+            settings(Collections.singletonList(new Http2Setting(0x00FFFF, 0x01020304))).
+            build();
+    
+    public static final byte[] SETTINGS_HIGHEST_VALUE_BUFFER = new byte[] {
+        0x00, 0x00, 0x06, /*length*/
+        0x04, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x00, 0x01, /*ID*/
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, /*value*/
+        };
+    
+    public static final Http2SettingsFrame SETTINGS_HIGHEST_VALUE_FRAME = Http2SettingsFrameBuilder.builder().
+            streamID(32).
+            settings(Collections.singletonList(new Http2Setting(1, 0xFFFFFFFFL))).
+            build();
+    
+    public static final byte[] UNKNOWN_PAYLOAD_BUFFER = new byte[] {
+        0x00, 0x00, 0x02, /*length*/
+        (byte) 0x00FF, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20, /*streamID*/
+        0x0E, 0x18
+        };
+    
+    public static final Http2UnknownFrame UNKNOWN_PAYLOAD_FRAME = Http2UnknownFrameBuilder.builder().
+            type((short) 255).
+            streamID(32).
+            payload(new byte[] { 0x0E, 0x18}).
+            build();
+    
+    public static final byte[] UNKNOWN_NO_PAYLOAD_BUFFER = new byte[] {
+        0x00, 0x00, 0x00, /*length*/
+        (byte) 0x00FF, /*type*/
+        0x00, /*flags*/
+        0x00, 0x00, 0x00, 0x20 /*streamID*/
+        };
+    
+    public static final Http2UnknownFrame UNKNOWN_NO_PAYLOAD_FRAME = Http2UnknownFrameBuilder.builder().
+            type((short) 255).
+            streamID(32).
+            build();
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/test/java/org/apache/mina/http2/api/BytePartialDecoderTest.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/api/BytePartialDecoderTest.java b/http2/src/test/java/org/apache/mina/http2/api/BytePartialDecoderTest.java
deleted file mode 100644
index 7d09d11..0000000
--- a/http2/src/test/java/org/apache/mina/http2/api/BytePartialDecoderTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.mina.http2.api;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-
-import org.junit.Test;
-
-public class BytePartialDecoderTest {
-
-    private static final byte[] SAMPLE_VALUE_1 = new byte[] {0x74, 0x18, 0x4F, 0x68};
-    private static final byte[] SAMPLE_VALUE_2 = new byte[] {0x74, 0x18, 0x4F, 0x68, 0x0F};
-
-    @Test
-    public void checkSimpleValue() {
-        BytePartialDecoder decoder = new BytePartialDecoder(4);
-        ByteBuffer buffer = ByteBuffer.wrap(SAMPLE_VALUE_1);
-        assertTrue(decoder.consume(buffer));
-        assertArrayEquals(SAMPLE_VALUE_1, decoder.getValue());
-    }
-    
-    @Test
-    public void checkNotenoughData() {
-        BytePartialDecoder decoder = new BytePartialDecoder(4);
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00});
-        assertFalse(decoder.consume(buffer));
-    }
-
-    @Test
-    public void checkTooMuchData() {
-        BytePartialDecoder decoder = new BytePartialDecoder(4);
-        ByteBuffer buffer = ByteBuffer.wrap(SAMPLE_VALUE_2);
-        assertTrue(decoder.consume(buffer));
-        assertArrayEquals(SAMPLE_VALUE_1, decoder.getValue());
-        assertEquals(1, buffer.remaining());
-    }
-
-    @Test
-    public void checkDecodingIn2Steps() {
-        BytePartialDecoder decoder = new BytePartialDecoder(4);
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {SAMPLE_VALUE_2[0], SAMPLE_VALUE_2[1]});
-        assertFalse(decoder.consume(buffer));
-        buffer = ByteBuffer.wrap(new byte[] {SAMPLE_VALUE_2[2], SAMPLE_VALUE_2[3], SAMPLE_VALUE_2[4]});
-        assertTrue(decoder.consume(buffer));
-        assertArrayEquals(SAMPLE_VALUE_1, decoder.getValue());
-        assertEquals(1, buffer.remaining());
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/test/java/org/apache/mina/http2/api/Htp2ContinuationFrameDecoderTest.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/api/Htp2ContinuationFrameDecoderTest.java b/http2/src/test/java/org/apache/mina/http2/api/Htp2ContinuationFrameDecoderTest.java
deleted file mode 100644
index 12a661c..0000000
--- a/http2/src/test/java/org/apache/mina/http2/api/Htp2ContinuationFrameDecoderTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.mina.http2.api;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import java.nio.ByteBuffer;
-
-import org.apache.mina.http2.impl.Http2Connection;
-import org.junit.Test;
-
-public class Htp2ContinuationFrameDecoderTest {
-
-    @Test
-    public void checkContinuationNoHeaderFragment() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x00, /*length*/
-                                                        0x09, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x32 /*streamID*/});
-        Http2ContinuationFrame frame = (Http2ContinuationFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(0, frame.getLength());
-        assertEquals(9, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(50, frame.getStreamID());
-        assertEquals(0, frame.getHeaderBlockFragment().length);
-    }
-    
-    @Test
-    public void checkContinuationWithHeaderFragment() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x0A, /*length*/
-                                                        0x09, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x32, /*streamID*/
-                                                        0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A /*headerFragment*/});
-        Http2ContinuationFrame frame = (Http2ContinuationFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(10, frame.getLength());
-        assertEquals(9, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(50, frame.getStreamID());
-        assertEquals(10, frame.getHeaderBlockFragment().length);
-        assertArrayEquals(new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A}, frame.getHeaderBlockFragment());
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/test/java/org/apache/mina/http2/api/Htp2DataFrameDecoderTest.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/api/Htp2DataFrameDecoderTest.java b/http2/src/test/java/org/apache/mina/http2/api/Htp2DataFrameDecoderTest.java
deleted file mode 100644
index f6dad67..0000000
--- a/http2/src/test/java/org/apache/mina/http2/api/Htp2DataFrameDecoderTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.apache.mina.http2.api;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import java.nio.ByteBuffer;
-
-import org.apache.mina.http2.impl.Http2Connection;
-import org.junit.Test;
-
-public class Htp2DataFrameDecoderTest {
-
-    @Test
-    public void checkDataNoPayloadNoPadding() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x00, /*length*/
-                                                        0x00, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x32 /*streamID*/});
-        Http2DataFrame frame = (Http2DataFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(0, frame.getLength());
-        assertEquals(0, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(50, frame.getStreamID());
-        assertEquals(0, frame.getData().length);
-        assertEquals(0, frame.getPadding().length);
-    }
-    
-    @Test
-    public void checkDataWithPayloadNoPadding() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x0A, /*length*/
-                                                        0x00, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x32, /*streamID*/
-                                                        0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A /*headerFragment*/});
-        Http2DataFrame frame = (Http2DataFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(10, frame.getLength());
-        assertEquals(0, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(50, frame.getStreamID());
-        assertEquals(10, frame.getData().length);
-        assertArrayEquals(new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A}, frame.getData());
-        assertEquals(0, frame.getPadding().length);
-    }
-
-    @Test
-    public void checkDataNoPayloadPadding() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x03, /*length*/
-                                                        0x00, /*type*/
-                                                        0x08, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x32, /*streamID*/
-                                                        0x02, 0x0E, 0x28 /*padding*/});
-        Http2DataFrame frame = (Http2DataFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(3, frame.getLength());
-        assertEquals(0, frame.getType());
-        assertEquals(0x08, frame.getFlags());
-        assertEquals(50, frame.getStreamID());
-        assertEquals(0,frame.getData().length);
-        assertEquals(2, frame.getPadding().length);
-        assertArrayEquals(new byte[] {0x0E,  0x28}, frame.getPadding());
-    }
-    
-    @Test
-    public void checkDataWithPayloadPadding() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x0D, /*length*/
-                                                        0x00, /*type*/
-                                                        0x08, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x32, /*streamID*/
-                                                        0x02, /*padLength*/
-                                                        0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, /*data*/
-                                                        0x0E, 0x28 /*padding*/});
-        Http2DataFrame frame = (Http2DataFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(13, frame.getLength());
-        assertEquals(0, frame.getType());
-        assertEquals(0x08, frame.getFlags());
-        assertEquals(50, frame.getStreamID());
-        assertEquals(10, frame.getData().length);
-        assertArrayEquals(new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A}, frame.getData());
-        assertEquals(2, frame.getPadding().length);
-        assertArrayEquals(new byte[] {0x0E, 0x28}, frame.getPadding());
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/http2/src/test/java/org/apache/mina/http2/api/Htp2HeadersFrameDecoderTest.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/api/Htp2HeadersFrameDecoderTest.java b/http2/src/test/java/org/apache/mina/http2/api/Htp2HeadersFrameDecoderTest.java
deleted file mode 100644
index e974ce5..0000000
--- a/http2/src/test/java/org/apache/mina/http2/api/Htp2HeadersFrameDecoderTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.mina.http2.api;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import java.nio.ByteBuffer;
-
-import org.apache.mina.http2.impl.Http2Connection;
-import org.junit.Test;
-
-public class Htp2HeadersFrameDecoderTest {
-
-    @Test
-    public void checkHeadersFrameWithNotPadding() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x01, /*length*/
-                                                        0x01, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x01, /*streamID*/
-                                                        (byte) 0x0082 /*headerFragment*/});
-        Http2HeadersFrame frame = (Http2HeadersFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(1, frame.getLength());
-        assertEquals(1, frame.getType());
-        assertEquals(0, frame.getFlags());
-        assertEquals(1, frame.getStreamID());
-        assertEquals(1, frame.getHeaderBlockFragment().length);
-        assertEquals(0x0082, frame.getHeaderBlockFragment()[0] & 0x00FF);
-    }
-    
-    
-    @Test
-    public void checkHeadersFramePaddingPriority() {
-        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*/
-                                                        0x08, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x03, /*streamID*/
-                                                        0x10, /*padding length*/
-                                                        (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());
-        assertEquals(0x08, frame.getFlags());
-        assertEquals(3, frame.getStreamID());
-        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/8ca3d89d/http2/src/test/java/org/apache/mina/http2/api/Htp2PriorityFrameDecoderTest.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/api/Htp2PriorityFrameDecoderTest.java b/http2/src/test/java/org/apache/mina/http2/api/Htp2PriorityFrameDecoderTest.java
deleted file mode 100644
index cd0c049..0000000
--- a/http2/src/test/java/org/apache/mina/http2/api/Htp2PriorityFrameDecoderTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.mina.http2.api;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-
-import org.apache.mina.http2.impl.Http2Connection;
-import org.junit.Test;
-
-public class Htp2PriorityFrameDecoderTest {
-
-    @Test
-    public void checkPriorityFrameNoExclusive() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x05, /*length*/
-                                                        0x02, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x20, /*streamID*/
-                                                        0x00, 0x00, 0x01, 0x00, /*streamDependency*/
-                                                        0x01});
-        Http2PriorityFrame frame = (Http2PriorityFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(5, frame.getLength());
-        assertEquals(2, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(32, frame.getStreamID());
-        assertEquals(256, frame.getStreamDependencyID());
-        assertFalse(frame.getExclusiveMode());
-    }
-
-    @Test
-    public void checkPriorityFrameExclusive() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x05, /*length*/
-                                                        0x02, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x20, /*streamID*/
-                                                        (byte) 0x0080, 0x00, 0x01, 0x00, /*streamDependency*/
-                                                        0x01});
-        Http2PriorityFrame frame = (Http2PriorityFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(5, frame.getLength());
-        assertEquals(2, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(32, frame.getStreamID());
-        assertEquals(256, frame.getStreamDependencyID());
-        assertTrue(frame.getExclusiveMode());
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/8ca3d89d/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
deleted file mode 100644
index 02f7198..0000000
--- a/http2/src/test/java/org/apache/mina/http2/api/Htp2PushPromiseFrameDecoderTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.apache.mina.http2.api;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import java.nio.ByteBuffer;
-
-import org.apache.mina.http2.impl.Http2Connection;
-import org.junit.Test;
-
-public class Htp2PushPromiseFrameDecoderTest {
-
-    @Test
-    public void checkWithNoPadding() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x05, /*length*/
-                                                        0x05, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x01, /*streamID*/
-                                                        0x00, 0x00, 0x01, 0x00, /*promisedStreamID*/
-                                                        (byte) 0x0082 /*headerFragment*/});
-        Http2PushPromiseFrame frame = (Http2PushPromiseFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(5, frame.getLength());
-        assertEquals(5, frame.getType());
-        assertEquals(0, frame.getFlags());
-        assertEquals(1, frame.getStreamID());
-        assertEquals(256, frame.getPromisedStreamID());
-        assertEquals(1, frame.getHeaderBlockFragment().length);
-        assertEquals(0x0082, frame.getHeaderBlockFragment()[0] & 0x00FF);
-    }
-    
-    
-    @Test
-    public void checkWithPadding() {
-        Http2Connection connection = new Http2Connection();
-        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*/});
-        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/8ca3d89d/http2/src/test/java/org/apache/mina/http2/api/Htp2RstStreamFrameDecoderTest.java
----------------------------------------------------------------------
diff --git a/http2/src/test/java/org/apache/mina/http2/api/Htp2RstStreamFrameDecoderTest.java b/http2/src/test/java/org/apache/mina/http2/api/Htp2RstStreamFrameDecoderTest.java
deleted file mode 100644
index 717b0f6..0000000
--- a/http2/src/test/java/org/apache/mina/http2/api/Htp2RstStreamFrameDecoderTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.apache.mina.http2.api;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-
-import org.apache.mina.http2.impl.Http2Connection;
-import org.junit.Test;
-
-public class Htp2RstStreamFrameDecoderTest {
-
-    @Test
-    public void checkRstStreamNoExtraPayload() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x04, /*length*/
-                                                        0x03, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x20, /*streamID*/
-                                                        0x00, 0x00, 0x01, 0x00, /*errorCode*/});
-        Http2RstStreamFrame frame = (Http2RstStreamFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(4, frame.getLength());
-        assertEquals(3, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(32, frame.getStreamID());
-        assertEquals(256, frame.getErrorCode());
-    }
-
-    @Test
-    public void checkRstStreamHighestValueNoExtraPayload() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x04, /*length*/
-                                                        0x03, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x20, /*streamID*/
-                                                        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, /*errorCode*/});
-        Http2RstStreamFrame frame = (Http2RstStreamFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(4, frame.getLength());
-        assertEquals(3, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(32, frame.getStreamID());
-        assertEquals(0x00FFFFFFFFL, frame.getErrorCode());
-    }
-
-    @Test
-    public void checkRstStreamWithExtraPayload() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x06, /*length*/
-                                                        0x03, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x20, /*streamID*/
-                                                        0x00, 0x00, 0x01, 0x00, /*errorCode*/
-                                                        0x0E, 0x28});
-        Http2RstStreamFrame frame = (Http2RstStreamFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(6, frame.getLength());
-        assertEquals(3, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(32, frame.getStreamID());
-        assertEquals(256, frame.getErrorCode());
-    }
-
-    @Test
-    public void checkRstStreamHighestValueWithExtraPayload() {
-        Http2Connection connection = new Http2Connection();
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x06, /*length*/
-                                                        0x03, /*type*/
-                                                        0x00, /*flags*/
-                                                        0x00, 0x00, 0x00, 0x20, /*streamID*/
-                                                        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, /*errorCode*/
-                                                        0x0E, 0x28});
-        Http2RstStreamFrame frame = (Http2RstStreamFrame) connection.decode(buffer);
-        assertNotNull(frame);
-        assertEquals(6, frame.getLength());
-        assertEquals(3, frame.getType());
-        assertEquals(0x00, frame.getFlags());
-        assertEquals(32, frame.getStreamID());
-        assertEquals(0x00FFFFFFFFL, frame.getErrorCode());
-    }
-}