@Override
    public void close() throws IOException {
        if (closed) {
            return;
        }

        try {
            if (buffer.position() > 0) {
                updateBuffer(false);
            }
        } finally {
            queue.add(ClickHouseByteBuffer.EMPTY_BUFFER);

            closed = true;
            ClickHouseDataStreamFactory.handleCustomAction(postCloseAction);
        }
    }
A combination of {@link java.io.PipedOutputStream} and
{@link java.io.PipedInputStream} for streaming data between server and
client. To avoid dead lock and high memory usage, please make sure writer and
reader are on two separate threads.
clickhouse-data/src/main/java/com/clickhouse/data/stream/NonBlockingPipedOutputStream.java