@VisibleForTesting
    Collection<CompletableFuture<Channel>> getResponseChannelFutures() {
        return responseChannelFutures;
    }
@Test
    void testResponseChannelFuturesResolvedExceptionallyOnClose() throws Exception {
        try (final RestClient restClient =
                new RestClient(new Configuration(), Executors.directExecutor())) {
            CompletableFuture<Channel> responseChannelFuture = new CompletableFuture<>();

            // Add the future to the client's internal collection of pending response futures
            restClient.getResponseChannelFutures().add(responseChannelFuture);

            // Close the client, which should resolve all pending response futures exceptionally and
            // clear the collection
            restClient.close();

            // Ensure the client's internal collection of pending response futures was cleared after
            // close
            assertThat(restClient.getResponseChannelFutures()).isEmpty();

            FlinkAssertions.assertThatFuture(responseChannelFuture)
                    .eventuallyFailsWith(ExecutionException.class)
                    .withCauseInstanceOf(IllegalStateException.class)
                    .extracting(Throwable::getCause, as(THROWABLE))
                    .hasMessage("RestClient closed before request completed");
        }
    }