From c1e398a92cf57259f67f6854c45650404bc3eb86 Mon Sep 17 00:00:00 2001 From: Scott Mitchell Date: Mon, 20 Oct 2014 16:31:39 -0400 Subject: [PATCH] HTTP/2 Stream ID unit tests Motivation: There should be a unit test for when the stream ID wraps around and is 'too large' or negative. The lack of unit test masked an issue where this was not being throw. Modifications: Add a unit test to cover the case where creating a remote and local stream where stream id is 'too large' Result: Unit test scope increases. --- .../codec/http2/DefaultHttp2ConnectionTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionTest.java b/codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionTest.java index e64544591b..d2f22469f1 100644 --- a/codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionTest.java +++ b/codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionTest.java @@ -210,6 +210,16 @@ public class DefaultHttp2ConnectionTest { assertTrue(server.activeStreams().isEmpty()); } + @Test(expected = Http2Exception.class) + public void localStreamInvalidStreamIdShouldThrow() throws Http2Exception { + client.createLocalStream(Integer.MAX_VALUE + 2, false); + } + + @Test(expected = Http2Exception.class) + public void remoteStreamInvalidStreamIdShouldThrow() throws Http2Exception { + client.createRemoteStream(Integer.MAX_VALUE + 1, false); + } + @Test public void prioritizeShouldUseDefaults() throws Exception { Http2Stream stream = client.local().createStream(1, false);