### Question:
RoundRobinLoadBalancer implements LoadBalancer<C> { @Override public Single<C> selectConnection(Predicate<C> selector) { return defer(() -> selectConnection0(selector).subscribeShareContext()); } RoundRobinLoadBalancer(final Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher,
                                  final ConnectionFactory<ResolvedAddress, ? extends C> connectionFactory); static RoundRobinLoadBalancerFactory<ResolvedAddress, C> newRoundRobinFactory(); @Override Single<C> selectConnection(Predicate<C> selector); @Override Publisher<Object> eventStream(); @Override Completable onClose(); @Override Completable closeAsync(); @Override Completable closeAsyncGracefully();  }### Answer:
@Test public void noServiceDiscoveryEvent() { selectConnectionListener.listen(lb.selectConnection(any())); selectConnectionListener.verifyFailure(NoAvailableHostException.class); assertThat(connectionsCreated, is(empty())); }
@Test public void connectionFactoryErrorPropagation() throws Exception { serviceDiscoveryPublisher.onComplete(); thrown.expect(instanceOf(ExecutionException.class)); thrown.expectCause(instanceOf(DeliberateException.class)); connectionFactory = new DelegatingConnectionFactory(__ -> failed(DELIBERATE_EXCEPTION)); lb = newTestLoadBalancer(connectionFactory); sendServiceDiscoveryEvents(upEvent("address-1")); awaitIndefinitely(lb.selectConnection(any())); }