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.
This commit is contained in:
Scott Mitchell 2014-10-20 16:31:39 -04:00
parent 2c95925609
commit c1e398a92c

View File

@ -210,6 +210,16 @@ public class DefaultHttp2ConnectionTest {
assertTrue(server.activeStreams().isEmpty()); 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 @Test
public void prioritizeShouldUseDefaults() throws Exception { public void prioritizeShouldUseDefaults() throws Exception {
Http2Stream stream = client.local().createStream(1, false); Http2Stream stream = client.local().createStream(1, false);