static ClickHouseOutputStream getAsyncRequestOutputStream(ClickHouseConfig config, OutputStream output,
            Runnable postCloseAction) {
        if (config == null || !config.isAsync()
                || config.getRequestBuffering() == ClickHouseBufferingMode.RESOURCE_EFFICIENT) {
            return getRequestOutputStream(config, output, postCloseAction);
        }

        final CountDownLatch latch = new CountDownLatch(1);
        final ClickHousePipedOutputStream stream = ClickHouseDataStreamFactory.getInstance()
                .createPipedOutputStream(config, () -> {
                    try {
                        latch.await();

                        if (postCloseAction != null) {
                            postCloseAction.run();
                        }
                    } catch (InterruptedException e) {
                        Thread.currentThread().interrupt();
                        throw new IllegalStateException("Stopped waiting for writes", e);
                    }
                });
        submit(() -> {
            try (ClickHouseInputStream in = stream.getInputStream();
                    ClickHouseOutputStream out = getRequestOutputStream(config, output, postCloseAction)) {
                in.pipe(out);
            } finally {
                latch.countDown();
            }
            return null;
        });
        return stream;
    }
Gets piped output stream for writing data into request asynchronously. When
{@code config} is {@code null}, {@code config.isAsync()} is {@code false}, or
request buffering mode is {@link ClickHouseBufferingMode#RESOURCE_EFFICIENT},
this method will be same as
{@link #getRequestOutputStream(ClickHouseConfig, OutputStream, Runnable)}.

@param config          optional configuration
@param output          non-null output stream
@param postCloseAction custom action will be performed right after closing
                       the output stream
@return wrapped output, or the same output if it's instance of
        {@link ClickHouseOutputStream}
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseClient.java