private ChannelFuture checkException(ChannelPromise promise) {
        Throwable t = lastException;
        if (t != null) {
            lastException = null;

            if (promise.isVoid()) {
                PlatformDependent.throwException(t);
            }

            return promise.setFailure(t);
        }

        return promise.setSuccess();
    }
Checks for the presence of an {@link Exception}.
plc4j/transports/test/src/main/java/io/netty/channel/embedded/Plc4xEmbeddedChannel.java