PendingWriteQueue { public void removeAndFail(Throwable cause) { assert ctx.executor().inEventLoop(); if (cause == null) { throw new NullPointerException("cause"); } PendingWrite write = head; if (write == null) { return; } ReferenceCountUtil.safeRelease(write.msg); ChannelPromise promise = write.promise; safeFail(promise, cause); recycle(write, true); } PendingWriteQueue(ChannelHandlerContext ctx); boolean isEmpty(); int size(); long bytes(); void add(Object msg, ChannelPromise promise); ChannelFuture removeAndWriteAll(); void removeAndFailAll(Throwable cause); void removeAndFail(Throwable cause); ChannelFuture removeAndWrite(); ChannelPromise remove(); Object current();  }
@Test public void testRemoveAndFail() { assertWriteFails(new TestHandler() { @Override public void flush(ChannelHandlerContext ctx) throws Exception { queue.removeAndFail(new TestException()); super.flush(ctx); } }, 1); }