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

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

        final ConcurrencyLimit concurrencyLimit =
                new DefaultConcurrencyLimit(ctx -> true, () -> 1, 100, 500);

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

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

        // Send two requests, where only the first one is delegated.
        final CompletableFuture<AggregatedHttpResponse> res1 = clientOne.execute(ctx1, req1).aggregate();
        final CompletableFuture<AggregatedHttpResponse> res2 = clientTwo.execute(ctx2, req2).aggregate();

        await().untilAsserted(() -> {
            assertThatThrownBy(() -> res2.whenComplete(NO_OP).join())
                    .hasCauseInstanceOf(UnprocessedRequestException.class)
                    .hasRootCauseInstanceOf(ConcurrencyLimitTimeoutException.class);
            assertThat(res1.whenComplete(NO_OP)).isNotDone();
        });

        actualRes1.close();
        await().untilAsserted(() -> assertThat(clientOne.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