FutureMono extends Mono<Void> { public static <F extends Future<Void>> Mono<Void> deferFuture(Supplier<F> deferredFuture) { return new DeferredFutureMono<>(deferredFuture); }  static Mono<Void> from(F future); static Mono<Void> deferFuture(Supplier<F> deferredFuture);  }
@Test public void testDeferredFutureMonoImmediate() { ImmediateEventExecutor eventExecutor = ImmediateEventExecutor.INSTANCE; Supplier<Future<Void>> promiseSupplier = () -> eventExecutor.newFailedFuture(new ClosedChannelException()); StepVerifier.create(FutureMono.deferFuture(promiseSupplier)) .expectError(AbortedException.class) .verify(Duration.ofSeconds(30)); }
@SuppressWarnings("FutureReturnValueIgnored") @Test public void testDeferredFutureMonoLater() { ImmediateEventExecutor eventExecutor = ImmediateEventExecutor.INSTANCE; Promise<Void> promise = eventExecutor.newPromise(); Supplier<Promise<Void>> promiseSupplier = () -> promise; StepVerifier.create(FutureMono.deferFuture(promiseSupplier)) .expectSubscription() .then(() -> promise.setFailure(new ClosedChannelException())) .expectError(AbortedException.class) .verify(Duration.ofSeconds(30)); }