S3TransportBuffer implements TransportBuffer { @Override public void close() { if (this.os != this.cos) { try { this.os.flush(); } catch (IOException e) { logger.warn("unable to flush os"); } try { this.os.close(); } catch (IOException e) { logger.warn("unable to close os"); } } try { this.cos.flush(); } catch (IOException e) { logger.warn("unable to flush cos"); } try { this.cos.close(); } catch (IOException e) { logger.warn("unable to close cos"); } } S3TransportBuffer(long maxBytes, boolean useCompression, S3TransportSerializer serializer); @Override boolean add(InternalEvent ievent); @Override ByteArrayOutputStream getInternalBuffer(); @Override boolean isEmpty(); @Override void close(); @Override void clear(); boolean isCompressed();  }
@Test public void testDoubleClose() throws IOException, TransportException { S3TransportSerializer serializer = mock(S3TransportSerializer.class); S3TransportBuffer buffer = new S3TransportBuffer(5, false, serializer); buffer.close(); buffer.close(); }