@Test
public void connectionErrorShouldStartShutdown() throws Exception {

    handler = newHandler();
    Http2Exception e = new Http2Exception(PROTOCOL_ERROR);
    when(remote.lastStreamCreated()).thenReturn(STREAM_ID);
    handler.exceptionCaught(ctx, e);
    ArgumentCaptor<ByteBuf> captor = ArgumentCaptor.forClass(ByteBuf.class);
    verify(frameWriter).writeGoAway(eq(ctx), eq(STREAM_ID), eq(PROTOCOL_ERROR.code()),
            captor.capture(), eq(promise));
    captor.getValue().release();
}