### Question:
RabbitMqConfig { Mono<Connection> createConnectionMono(ConnectionFactory factory, String connectionPrefix, String connectionType) { return Mono.fromCallable(() -> factory.newConnection(connectionPrefix + " " + connectionType)) .doOnError(err -> log.log(Level.SEVERE, "Error creating connection to RabbitMq Broker. Starting retry process...", err) ) .retryWhen(Retry.backoff(Long.MAX_VALUE, Duration.ofMillis(300)) .maxBackoff(Duration.ofMillis(3000))) .cache(); }  @Bean ReactiveMessageSender messageSender(MessageConverter converter, BrokerConfigProps brokerConfigProps, SenderOptions senderOptions); @Bean SenderOptions reactiveCommonsSenderOptions(ConnectionFactoryProvider provider, RabbitProperties rabbitProperties); @Bean ReactiveMessageListener messageListener(ConnectionFactoryProvider provider); @Bean @ConditionalOnMissingBean BrokerConfig brokerConfig(); @Bean @ConditionalOnMissingBean ConnectionFactoryProvider rabbitRConnectionFactory(RabbitProperties properties); @Bean @ConditionalOnMissingBean ObjectMapperSupplier objectMapperSupplier(); @Bean @ConditionalOnMissingBean MessageConverter messageConverter(ObjectMapperSupplier objectMapperSupplier); @Bean @ConditionalOnMissingBean DiscardNotifier rabbitDiscardNotifier(ObjectMapperSupplier objectMapperSupplier, ReactiveMessageSender sender, BrokerConfigProps props); @Bean HandlerResolver resolver(ApplicationContext context, DefaultCommandHandler defaultCommandHandler); @Bean DynamicRegistry dynamicRegistry(HandlerResolver resolver, ReactiveMessageListener listener, IBrokerConfigProps props); @Bean @ConditionalOnMissingBean DefaultQueryHandler defaultHandler(); @Bean @ConditionalOnMissingBean DefaultCommandHandler defaultCommandHandler();  }### Answer:
@Test public void retryInitialConnection() throws IOException, TimeoutException { final String connectionType = "sender"; final String appName = "appName"; final String connectionName = "appName sender"; final AtomicInteger count = new AtomicInteger(); final Connection connection = mock(Connection.class); ConnectionFactory factory = mock(ConnectionFactory.class); when(factory.newConnection(connectionName)).thenAnswer(invocation -> { if(count.incrementAndGet() == 10){ return connection; } throw new RuntimeException(); }); StepVerifier.withVirtualTime(() -> config.createConnectionMono(factory, appName, connectionType)) .thenAwait(Duration.ofMinutes(2)) .expectNext(connection).verifyComplete(); }