private byte[] getBufIfOpen() throws IOException {
        byte[] buffer = intermediateBuf;
        if (buffer == null)
            throw new IOException("Stream closed");
        return buffer;
    }
Check to make sure that buffer has not been nulled out due to
close; if not return it;
clients/src/main/java/org/apache/kafka/common/utils/ChunkedBytesStream.java