public int numBufferedStreams() {
        return pendingStreams.size();
    }
@Test
    public void bufferingNewStreamFailsAfterGoAwayReceived() throws Http2Exception {
        encoder.writeSettingsAck(ctx, newPromise());
        setMaxConcurrentStreams(0);
        connection.goAwayReceived(1, 8, EMPTY_BUFFER);

        ChannelPromise promise = newPromise();
        encoderWriteHeaders(3, promise);
        assertEquals(0, encoder.numBufferedStreams());
        assertTrue(promise.isDone());
        assertFalse(promise.isSuccess());
    }