@Test public void closeIsRentrantSafe() throws Exception { MessageFramer.Sink reentrant = new MessageFramer.Sink() { int count = 0; @Override public void deliverFrame( WritableBuffer frame, boolean endOfStream, boolean flush, int numMessages) { if (count == 0) { framer.close(); count++; } else { fail("received event from reentrant call to close"); } } }; framer = new MessageFramer(reentrant, allocator, statsTraceCtx); writeKnownLength(framer, new byte[]{3, 14}); framer.close(); }
@Override public void close() { if (!isClosed()) { closed = true; if (buffer != null && buffer.readableBytes() == 0) { releaseBuffer(); } commitToSink(true, true); } }
MessageFramer implements Framer { @Override public void close() { if (!isClosed()) { closed = true; if (buffer != null && buffer.readableBytes() == 0) { releaseBuffer(); } commitToSink(true, true); } } }
MessageFramer implements Framer { @Override public void close() { if (!isClosed()) { closed = true; if (buffer != null && buffer.readableBytes() == 0) { releaseBuffer(); } commitToSink(true, true); } } MessageFramer(
      Sink sink, WritableBufferAllocator bufferAllocator, StatsTraceContext statsTraceCtx); }
MessageFramer implements Framer { @Override public void close() { if (!isClosed()) { closed = true; if (buffer != null && buffer.readableBytes() == 0) { releaseBuffer(); } commitToSink(true, true); } } MessageFramer(
      Sink sink, WritableBufferAllocator bufferAllocator, StatsTraceContext statsTraceCtx); @Override MessageFramer setCompressor(Compressor compressor); @Override MessageFramer setMessageCompression(boolean enable); @Override void setMaxOutboundMessageSize(int maxSize); @Override void writePayload(InputStream message); @Override void flush(); @Override boolean isClosed(); @Override void close(); @Override void dispose(); }
MessageFramer implements Framer { @Override public void close() { if (!isClosed()) { closed = true; if (buffer != null && buffer.readableBytes() == 0) { releaseBuffer(); } commitToSink(true, true); } } MessageFramer(
      Sink sink, WritableBufferAllocator bufferAllocator, StatsTraceContext statsTraceCtx); @Override MessageFramer setCompressor(Compressor compressor); @Override MessageFramer setMessageCompression(boolean enable); @Override void setMaxOutboundMessageSize(int maxSize); @Override void writePayload(InputStream message); @Override void flush(); @Override boolean isClosed(); @Override void close(); @Override void dispose();  }