Author: markt
Date: Fri Jun 26 19:07:09 2015
New Revision: 1687839

URL: http://svn.apache.org/r1687839
Log:
Add utility method to help with testing goaway frames

Modified:
    tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java

Modified: tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java?rev=1687839&r1=1687838&r2=1687839&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Fri Jun 26 
19:07:09 2015
@@ -506,6 +506,30 @@ public abstract class Http2TestBase exte
     }
 
 
+    void sendGoaway(int streamId, int lastStreamId, long errorCode, byte[] 
debug)
+            throws IOException {
+        byte[] goawayFrame = new byte[17];
+        int len = 8;
+        if (debug != null) {
+            len += debug.length;
+        }
+        ByteUtil.setThreeBytes(goawayFrame, 0, len);
+        // Type
+        goawayFrame[3] = FrameType.GOAWAY.getIdByte();
+        // No flags
+        // Stream
+        ByteUtil.set31Bits(goawayFrame, 5, streamId);
+        // Last stream
+        ByteUtil.set31Bits(goawayFrame, 9, lastStreamId);
+        ByteUtil.setFourBytes(goawayFrame, 13, errorCode);
+        os.write(goawayFrame);
+        if (debug != null && debug.length > 0) {
+            os.write(debug);
+        }
+        os.flush();
+    }
+
+
     void sendWindowUpdate(int streamId, int increment) throws IOException {
         byte[] updateFrame = new byte[13];
         // length is always 4



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to