Test receiving invalid stream IDs in okhttp

Fixes #173
This commit is contained in:
nmittler 2015-03-09 14:10:10 -07:00
parent f1b6f623c5
commit fad21aafe7
1 changed files with 14 additions and 0 deletions

View File

@ -178,6 +178,20 @@ public class OkHttpClientTransportTest {
}
}
@Test
public void receivedHeadersForInvalidStreamShouldResetStream() throws Exception {
// Empty headers block without correct content type or status
frameHandler.headers(false, false, 3, 0, new ArrayList<Header>(),
HeadersMode.HTTP_20_HEADERS);
verify(frameWriter).rstStream(eq(3), eq(ErrorCode.INVALID_STREAM));
}
@Test
public void receivedDataForInvalidStreamShouldResetStream() throws Exception {
frameHandler.data(false, 3, createMessageFrame(new String(new char[1000])), 1000);
verify(frameWriter).rstStream(eq(3), eq(ErrorCode.INVALID_STREAM));
}
@Test
public void invalidInboundHeadersCancelStream() throws Exception {
MockStreamListener listener = new MockStreamListener();