### Question:
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public void resetConnectBackoff() { final class ResetConnectBackoff implements Runnable { @Override public void run() { if (shutdown.get()) { return; } if (nameResolverRefreshFuture != null) { checkState(nameResolverStarted, "name resolver must be started"); cancelNameResolverBackoff(); nameResolver.refresh(); } for (InternalSubchannel subchannel : subchannels) { subchannel.resetConnectBackoff(); } for (OobChannel oobChannel : oobChannels) { oobChannel.resetConnectBackoff(); } } } syncContext.execute(new ResetConnectBackoff()); } ManagedChannelImpl(
      AbstractManagedChannelImplBuilder<?> builder,
      ClientTransportFactory clientTransportFactory,
      BackoffPolicy.Provider backoffPolicyProvider,
      ObjectPool<? extends Executor> balancerRpcExecutorPool,
      Supplier<Stopwatch> stopwatchSupplier,
      List<ClientInterceptor> interceptors,
      final TimeProvider timeProvider); @Override ListenableFuture<ChannelStats> getStats(); @Override InternalLogId getLogId(); @Override ManagedChannelImpl shutdown(); @Override ManagedChannelImpl shutdownNow(); @Override boolean isShutdown(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override boolean isTerminated(); @Override ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method,
      CallOptions callOptions); @Override String authority(); @Override ConnectivityState getState(boolean requestConnection); @Override void notifyWhenStateChanged(final ConnectivityState source, final Runnable callback); @Override void resetConnectBackoff(); @Override void enterIdle(); @Override String toString(); @Override Map<String, String> getLoadBalanceModeMap(); @Override void setLoadBalanceModeMap(Map<String, String> map); @Override NameResolver getNameResolver(); @Override LoadBalancer getLoadBalancer();  }### Answer:
@Test public void resetConnectBackoff() { Status error = Status.UNAVAILABLE.withCause(new Throwable("fake name resolution error")); FakeNameResolverFactory nameResolverFactory = new FakeNameResolverFactory.Builder(expectedUri).setError(error).build(); channelBuilder.nameResolverFactory(nameResolverFactory); createChannel(); FakeNameResolverFactory.FakeNameResolver resolver = nameResolverFactory.resolvers.get(0); verify(mockLoadBalancer).handleNameResolutionError(same(error)); FakeClock.ScheduledTask nameResolverBackoff = getNameResolverRefresh(); assertNotNull("There should be a name resolver backoff task", nameResolverBackoff); assertEquals(0, resolver.refreshCalled); channel.resetConnectBackoff(); assertEquals(1, resolver.refreshCalled); assertTrue(nameResolverBackoff.isCancelled()); nameResolverBackoff.command.run(); assertEquals(1, resolver.refreshCalled); timer.forwardNanos(RECONNECT_BACKOFF_INTERVAL_NANOS); assertEquals(2, resolver.refreshCalled); }
@Test public void resetConnectBackoff_noOpWithoutPendingResolverBackoff() { FakeNameResolverFactory nameResolverFactory = new FakeNameResolverFactory.Builder(expectedUri) .setServers(Collections.singletonList(new EquivalentAddressGroup(socketAddress))) .build(); channelBuilder.nameResolverFactory(nameResolverFactory); createChannel(); FakeNameResolverFactory.FakeNameResolver nameResolver = nameResolverFactory.resolvers.get(0); assertEquals(0, nameResolver.refreshCalled); channel.resetConnectBackoff(); assertEquals(0, nameResolver.refreshCalled); }
@Test public void resetConnectBackoff_noOpWhenNameResolverNotStarted() { FakeNameResolverFactory nameResolverFactory = new FakeNameResolverFactory.Builder(expectedUri).build(); channelBuilder.nameResolverFactory(nameResolverFactory); requestConnection = false; createChannel(); channel.resetConnectBackoff(); FakeNameResolverFactory.FakeNameResolver nameResolver = nameResolverFactory.resolvers.get(0); assertEquals(0, nameResolver.refreshCalled); }