@Test public void handleResolvedAddressGroups_keepOldBalancer() { final List<EquivalentAddressGroup> servers = Collections.singletonList( new EquivalentAddressGroup(new SocketAddress(){}, Attributes.EMPTY)); Helper helper = new TestHelper() { @Override public Subchannel createSubchannel(List<EquivalentAddressGroup> addrs, Attributes attrs) { assertThat(addrs).isEqualTo(servers); return new TestSubchannel(addrs, attrs); } @Override public void updateBalancingState(ConnectivityState newState, SubchannelPicker newPicker) { } }; AutoConfiguredLoadBalancer lb = (AutoConfiguredLoadBalancer) lbf.newLoadBalancer(helper); LoadBalancer oldDelegate = lb.getDelegate(); lb.handleResolvedAddressGroups(servers, Attributes.EMPTY); assertThat(lb.getDelegate()).isSameAs(oldDelegate); }
@Override public LoadBalancer newLoadBalancer(Helper helper) { return new AutoConfiguredLoadBalancer(helper); }
AutoConfiguredLoadBalancerFactory extends LoadBalancer.Factory { @Override public LoadBalancer newLoadBalancer(Helper helper) { return new AutoConfiguredLoadBalancer(helper); } }
AutoConfiguredLoadBalancerFactory extends LoadBalancer.Factory { @Override public LoadBalancer newLoadBalancer(Helper helper) { return new AutoConfiguredLoadBalancer(helper); }  }
AutoConfiguredLoadBalancerFactory extends LoadBalancer.Factory { @Override public LoadBalancer newLoadBalancer(Helper helper) { return new AutoConfiguredLoadBalancer(helper); }  @Override LoadBalancer newLoadBalancer(Helper helper); }
AutoConfiguredLoadBalancerFactory extends LoadBalancer.Factory { @Override public LoadBalancer newLoadBalancer(Helper helper) { return new AutoConfiguredLoadBalancer(helper); }  @Override LoadBalancer newLoadBalancer(Helper helper);  }