@Test
    void skipsConcurrencyBasedOnRequestContext() throws Exception {
        final ClientRequestContext ctx1 = newContext();
        final ClientRequestContext ctx2 = newContext();
        final HttpRequest req1 = newReq();
        final HttpRequest req2 = newReq();
        final HttpResponseWriter actualRes1 = HttpResponse.streaming();
        final HttpResponseWriter actualRes2 = HttpResponse.streaming();

        when(delegate.execute(ctx1, req1)).thenReturn(actualRes1);
        when(delegate.execute(ctx2, req2)).thenReturn(actualRes2);

        final ConcurrencyLimit concurrencyLimit =
                new DefaultConcurrencyLimit(requestContext -> false, () -> 2, 100, 500);

        final ConcurrencyLimitingClient client =
                newDecorator(concurrencyLimit).apply(delegate);

        // both requests should be delegated immediately, creating no deferred response.
        final HttpResponse res1 = client.execute(ctx1, req1);
        final HttpResponse res2 = client.execute(ctx2, req2);

        await().untilAsserted(() -> assertThat(client.numActiveRequests()).isEqualTo(2));

        verify(delegate).execute(ctx1, req1);
        assertThat(res1.isOpen()).isTrue();

        verify(delegate).execute(ctx2, req2);
        assertThat(res2.isOpen()).isTrue();

        // Complete the response, leaving no active requests.
        closeAndDrain(actualRes1, res1);
        closeAndDrain(actualRes2, res2);
        await().untilAsserted(() -> assertThat(client.numActiveRequests()).isZero());
    }
Tests the case where a delegate raises an exception rather than returning a response.
core/src/test/java/com/linecorp/armeria/client/limit/ConcurrencyLimitingClientTest.java