CoalescingBufferQueue { public void releaseAndFailAll(Throwable cause) { releaseAndCompleteAll(channel.newFailedFuture(cause)); } CoalescingBufferQueue(Channel channel); void add(ByteBuf buf); void add(ByteBuf buf, ChannelPromise promise); void add(ByteBuf buf, ChannelFutureListener listener); ByteBuf remove(int bytes, ChannelPromise aggregatePromise); int readableBytes(); boolean isEmpty(); void releaseAndFailAll(Throwable cause); void copyTo(CoalescingBufferQueue dest);  }
@Test public void testReleaseAndFailAll() { writeQueue.add(cat, catPromise); writeQueue.add(mouse, mouseListener); RuntimeException cause = new RuntimeException("ooops"); writeQueue.releaseAndFailAll(cause); DefaultChannelPromise aggregatePromise = newPromise(); assertQueueSize(0, true); assertEquals(0, cat.refCnt()); assertEquals(0, mouse.refCnt()); assertSame(cause, catPromise.cause()); assertEquals("", dequeue(Integer.MAX_VALUE, aggregatePromise)); assertQueueSize(0, true); }