@Test
public void canSendGoAwayUsingVoidPromise() throws Exception {

    handler = newHandler();
    ByteBuf data = dummyData();
    long errorCode = Http2Error.INTERNAL_ERROR.code();
    handler = newHandler();
    final Throwable cause = new RuntimeException("fake exception");
    doAnswer(new Answer<ChannelFuture>() {
        @Override
        public ChannelFuture answer(InvocationOnMock invocation) throws Throwable {
            ChannelPromise promise = invocation.getArgument(4);
            assertFalse(promise.isVoid());
            // This is what DefaultHttp2FrameWriter does... I hate mocking :-(.
            SimpleChannelPromiseAggregator aggregatedPromise =
                    new SimpleChannelPromiseAggregator(promise, channel, ImmediateEventExecutor.INSTANCE);
            aggregatedPromise.newPromise();
            aggregatedPromise.doneAllocatingPromises();
            return aggregatedPromise.setFailure(cause);
        }
    }).when(frameWriter).writeGoAway(
            any(ChannelHandlerContext.class), anyInt(), anyLong(), any(ByteBuf.class), any(ChannelPromise.class));
    handler.goAway(ctx, STREAM_ID, errorCode, data, newVoidPromise(channel));
    verify(pipeline).fireExceptionCaught(cause);
}