You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/07/17 22:12:53 UTC
svn commit: r1802225 - /tomcat/trunk/test/org/apache/coyote/http2/
Author: markt
Date: Mon Jul 17 22:12:53 2017
New Revision: 1802225
URL: http://svn.apache.org/viewvc?rev=1802225&view=rev
Log:
Connection reset exceptions are not consistent. Roll out special handling for Windows + NIO2 more widely.
Modified:
tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_3.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_5.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_3.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_4.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_5.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_7.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.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=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Mon Jul 17 22:12:53 2017
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
+import java.net.SocketException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -36,6 +37,7 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import org.junit.Assert;
+import org.junit.Assume;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
@@ -805,6 +807,34 @@ public abstract class Http2TestBase exte
}
+ void handleGoAwayResponse(int lastStream) throws Http2Exception, IOException {
+ handleGoAwayResponse(lastStream, Http2Error.PROTOCOL_ERROR);
+ }
+
+
+ void handleGoAwayResponse(int lastStream, Http2Error expectedError)
+ throws Http2Exception, IOException {
+ try {
+ parser.readFrame(true);
+
+ Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
+ "0-Goaway-[" + lastStream + "]-[" + expectedError.getCode() + "]-["));
+ } catch (SocketException se) {
+ // On some platform / Connector combinations (e.g. Windows / NIO2),
+ // the TCP connection close will be processed before the client gets
+ // a chance to read the connection close frame.
+ Tomcat tomcat = getTomcatInstance();
+ Connector connector = tomcat.getConnector();
+
+ Assume.assumeTrue("This test is only expected to trigger an exception with NIO2",
+ connector.getProtocolHandlerClassName().contains("Nio2"));
+
+ Assume.assumeTrue("This test is only expected to trigger an exception on Windo9ws",
+ System.getProperty("os.name").startsWith("Windows"));
+ }
+ }
+
+
static void setOneBytes(byte[] output, int firstByte, int value) {
output[firstByte] = (byte) (value & 0xFF);
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_2.java Mon Jul 17 22:12:53 2017
@@ -16,15 +16,9 @@
*/
package org.apache.coyote.http2;
-import java.net.SocketException;
-
import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Test;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-
/**
* Unit tests for Section 4.2 of
* <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
@@ -61,22 +55,7 @@ public class TestHttp2Section_4_2 extend
os.write(settings);
- try {
- // Read GOAWAY frame
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
- } catch (SocketException se) {
- // On some platform / Connector combinations (e.g. Windows / NIO2),
- // the TCP connection close will be processed before the client gets
- // a chance to read the connection close frame.
- Tomcat tomcat = getTomcatInstance();
- Connector connector = tomcat.getConnector();
-
- Assume.assumeTrue("This test is only expected to trigger an exception with NIO2",
- connector.getProtocolHandlerClassName().contains("Nio2"));
- }
+ handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
}
@Test
@@ -98,11 +77,7 @@ public class TestHttp2Section_4_2 extend
os.write(ping);
- // Read GOAWAY frame
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
}
@@ -124,11 +99,7 @@ public class TestHttp2Section_4_2 extend
os.write(ping);
- // Read GOAWAY frame
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
}
@@ -151,7 +122,7 @@ public class TestHttp2Section_4_2 extend
os.write(priority);
- // Read GOAWAY frame
+ // Read Stream reset frame
parser.readFrame(true);
Assert.assertTrue(output.getTrace(),
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_3.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_3.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_3.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_4_3.java Mon Jul 17 22:12:53 2017
@@ -46,11 +46,7 @@ public class TestHttp2Section_4_3 extend
// Process the request
writeFrame(frameHeader, headersPayload);
- // Read GOAWAY frame
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.COMPRESSION_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
}
@@ -91,10 +87,6 @@ public class TestHttp2Section_4_3 extend
sendPing();
- // Read GOAWAY frame
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.COMPRESSION_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
}
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_1.java Mon Jul 17 22:12:53 2017
@@ -16,16 +16,11 @@
*/
package org.apache.coyote.http2;
-import java.net.SocketException;
import java.nio.ByteBuffer;
import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Test;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-
/**
* Unit tests for Section 5.§ of
* <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
@@ -41,10 +36,7 @@ public class TestHttp2Section_5_1 extend
sendWindowUpdate(3, 200);
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -54,10 +46,7 @@ public class TestHttp2Section_5_1 extend
sendData(3, new byte[] {});
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -75,12 +64,10 @@ public class TestHttp2Section_5_1 extend
Assert.assertEquals(getSimpleResponseTrace(3), output.getTrace());
output.clearTrace();
- // This should trigger a stream error
+ // This should trigger a connection error
sendData(3, new byte[] {});
- parser.readFrame(true);
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[3]-[" + Http2Error.STREAM_CLOSED.getCode() + "]-["));
+ handleGoAwayResponse(3, Http2Error.STREAM_CLOSED);
}
@@ -116,12 +103,10 @@ public class TestHttp2Section_5_1 extend
public void testClosedInvalidFrame02() throws Exception {
http2Connect();
- // Stream 1 is closed. This should trigger a stream error
+ // Stream 1 is closed. This should trigger a connection error
sendData(1, new byte[] {});
- parser.readFrame(true);
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.STREAM_CLOSED.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.STREAM_CLOSED);
}
@@ -140,22 +125,7 @@ public class TestHttp2Section_5_1 extend
buildSimpleGetRequestPart1(frameHeader, headersPayload, 4);
writeFrame(frameHeader, headersPayload);
- try {
- // headers
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
- } catch (SocketException se) {
- // On some platform / Connector combinations (e.g. Windows / NIO2),
- // the TCP connection close will be processed before the client gets
- // a chance to read the connection close frame.
- Tomcat tomcat = getTomcatInstance();
- Connector connector = tomcat.getConnector();
-
- Assume.assumeTrue("This test is only expected to trigger an exception with NIO2",
- connector.getProtocolHandlerClassName().contains("Nio2"));
- }
+ handleGoAwayResponse(1);
}
@@ -176,11 +146,7 @@ public class TestHttp2Section_5_1 extend
os.write(frameHeader);
os.flush();
- // headers
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[5]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(5);
}
@@ -200,10 +166,7 @@ public class TestHttp2Section_5_1 extend
// closed.
sendSimpleGetRequest(3);
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[5]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(5);
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_5.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_5.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_5.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_5.java Mon Jul 17 22:12:53 2017
@@ -91,11 +91,6 @@ public class TestHttp2Section_5_5 extend
os.write(UNKNOWN_FRAME);
os.flush();
- // Read GOAWAY frame
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.COMPRESSION_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
}
-
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_1.java Mon Jul 17 22:12:53 2017
@@ -112,10 +112,7 @@ public class TestHttp2Section_6_1 extend
os.write(dataFrame);
os.flush();
- parser.readFrame(true);
-
- String trace = output.getTrace();
- Assert.assertTrue(trace, trace.startsWith("0-Goaway-[1]-[1]-["));
+ handleGoAwayResponse(1);
}
@@ -139,10 +136,7 @@ public class TestHttp2Section_6_1 extend
os.write(dataFrame);
os.flush();
- parser.readFrame(true);
-
- String trace = output.getTrace();
- Assert.assertTrue(trace, trace.startsWith("0-Goaway-[1]-[1]-["));
+ handleGoAwayResponse(1);
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_2.java Mon Jul 17 22:12:53 2017
@@ -16,16 +16,11 @@
*/
package org.apache.coyote.http2;
-import java.net.SocketException;
import java.nio.ByteBuffer;
import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Test;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-
/**
* Unit tests for Section 6.2 of
* <a href="https://tools.ietf.org/html/rfc7540">RFC 7540</a>.
@@ -46,22 +41,7 @@ public class TestHttp2Section_6_2 extend
buildSimpleGetRequestPart1(frameHeader, headersPayload, 0);
writeFrame(frameHeader, headersPayload);
- try {
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
- } catch (SocketException se) {
- // On some platform / Connector combinations (e.g. Windows / NIO2),
- // the TCP connection close will be processed before the client gets
- // a chance to read the connection close frame.
- Tomcat tomcat = getTomcatInstance();
- Connector connector = tomcat.getConnector();
-
- Assume.assumeTrue("This test is only expected to trigger an exception with NIO2",
- connector.getProtocolHandlerClassName().contains("Nio2"));
- }
+ handleGoAwayResponse(1);
}
@@ -86,11 +66,7 @@ public class TestHttp2Section_6_2 extend
sendSimpleGetRequest(3, padding);
- // Goaway
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -114,10 +90,7 @@ public class TestHttp2Section_6_2 extend
os.write(headerFrame);
os.flush();
- parser.readFrame(true);
-
- String trace = output.getTrace();
- Assert.assertTrue(trace, trace.startsWith("0-Goaway-[1]-[1]-["));
+ handleGoAwayResponse(1);
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_3.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_3.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_3.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_3.java Mon Jul 17 22:12:53 2017
@@ -37,11 +37,7 @@ public class TestHttp2Section_6_3 extend
sendPriority(0, 1, 15);
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -58,11 +54,7 @@ public class TestHttp2Section_6_3 extend
sendPriority(5, 3, 15);
- // Read GOAWAY frame
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.COMPRESSION_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
}
@@ -85,7 +77,7 @@ public class TestHttp2Section_6_3 extend
os.write(priorityFrame);
os.flush();
- // Read GOAWAY frame
+ // Read reset frame
parser.readFrame(true);
Assert.assertEquals("3-RST-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]\n",
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_4.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_4.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_4.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_4.java Mon Jul 17 22:12:53 2017
@@ -35,11 +35,7 @@ public class TestHttp2Section_6_4 extend
sendRst(0, Http2Error.NO_ERROR.getCode());
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -51,11 +47,7 @@ public class TestHttp2Section_6_4 extend
sendPriority(3, 0, 15);
sendRst(3, Http2Error.NO_ERROR.getCode());
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -78,7 +70,7 @@ public class TestHttp2Section_6_4 extend
os.write(resetFrame);
os.flush();
- // Read GOAWAY frame
+ // Read reset frame
parser.readFrame(true);
Assert.assertEquals("3-RST-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]\n",
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_5.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_5.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_5.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_5.java Mon Jul 17 22:12:53 2017
@@ -36,11 +36,7 @@ public class TestHttp2Section_6_5 extend
sendSettings(0, true, new SettingValue(1,1));
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
}
@@ -52,11 +48,7 @@ public class TestHttp2Section_6_5 extend
sendPriority(3, 0, 15);
sendSettings(3, true, new SettingValue(1,1));
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -78,11 +70,7 @@ public class TestHttp2Section_6_5 extend
os.write(resetFrame);
os.flush();
- // Read GOAWAY frame
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
}
@@ -95,11 +83,7 @@ public class TestHttp2Section_6_5 extend
sendSettings(0, false, new SettingValue(0x2,0x2));
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -110,11 +94,7 @@ public class TestHttp2Section_6_5 extend
sendSettings(0, false, new SettingValue(0x4,1 << 31));
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FLOW_CONTROL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.FLOW_CONTROL_ERROR);
}
@@ -125,11 +105,7 @@ public class TestHttp2Section_6_5 extend
sendSettings(0, false, new SettingValue(0x5,1 << 31));
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_7.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_7.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_7.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_7.java Mon Jul 17 22:12:53 2017
@@ -67,11 +67,7 @@ public class TestHttp2Section_6_7 extend
sendPing(1, false, "76543210".getBytes(StandardCharsets.ISO_8859_1));
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -82,11 +78,6 @@ public class TestHttp2Section_6_7 extend
sendPing(0, false, "6543210".getBytes(StandardCharsets.ISO_8859_1));
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
}
-
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_8.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_8.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_8.java Mon Jul 17 22:12:53 2017
@@ -91,11 +91,7 @@ public class TestHttp2Section_6_8 extend
sendGoaway(1, 1, Http2Error.NO_ERROR.getCode(), null);
- // Go away
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java?rev=1802225&r1=1802224&r2=1802225&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java Mon Jul 17 22:12:53 2017
@@ -36,10 +36,7 @@ public class TestHttp2Section_6_9 extend
sendWindowUpdate(0, 0);
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1);
}
@@ -89,10 +86,7 @@ public class TestHttp2Section_6_9 extend
os.write(zeroLengthWindowFrame);
os.flush();
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
}
@@ -150,10 +144,7 @@ public class TestHttp2Section_6_9 extend
// Super size the flow control window.
sendWindowUpdate(0, (1 << 31) - 1);
- parser.readFrame(true);
-
- Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
- "0-Goaway-[1]-[" + Http2Error.FLOW_CONTROL_ERROR.getCode() + "]-["));
+ handleGoAwayResponse(1, Http2Error.FLOW_CONTROL_ERROR);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org