AzureBlobOutputStream extends OutputStream { public synchronized void releaseBuffer() throws IOException { if (byteArrayOutputStream.isPresent()) { byteArrayOutputStream.get().close(); byteArrayOutputStream = Optional.empty(); LOG.info("Internal buffer has been released for blob " + blobAsyncClient.getBlobUrl().toString() + ". Writes are no longer entertained."); } } AzureBlobOutputStream(BlockBlobAsyncClient blobAsyncClient, Executor blobThreadPool, AzureBlobWriterMetrics metrics,
      BlobMetadataGeneratorFactory blobMetadataGeneratorFactory, Config blobMetadataGeneratorConfig, String streamName,
      long flushTimeoutMs, int maxBlockFlushThresholdSize, Compression compression); @VisibleForTesting  AzureBlobOutputStream(BlockBlobAsyncClient blobAsyncClient, Executor blobThreadPool, AzureBlobWriterMetrics metrics,
      BlobMetadataGeneratorFactory blobMetadataGeneratorFactory, Config blobMetadataGeneratorConfig, String streamName,
      long flushTimeoutMs, int maxBlockFlushThresholdSize,
      ByteArrayOutputStream byteArrayOutputStream, Compression compression); @Override synchronized void write(int b); @Override synchronized void write(byte[] b, int off, int len); @Override synchronized void flush(); @Override synchronized void close(); synchronized long getSize(); synchronized void releaseBuffer(); synchronized void incrementNumberOfRecordsInBlob();  }
@Test public void testReleaseBuffer() throws Exception { azureBlobOutputStream.releaseBuffer(); verify(mockByteArrayOutputStream).close(); }