### Question:
GrpcChannels { public static ManagedChannelBuilder createChannelBuilder(String serviceUri, StorageClientSettings settings) { ServiceURI uri = ServiceURI.create(serviceUri); ManagedChannelBuilder builder; if (uri.getServiceInfos().length > 0 && uri.getServiceInfos()[0].equals(BACKEND_INPROCESS)) { String serviceName = uri.getServiceHosts()[0]; builder = InProcessChannelBuilder.forName(serviceName).directExecutor(); } else if (null == uri.getServiceName() || ServiceURI.SERVICE_BK.equals(uri.getServiceName())) { builder = ManagedChannelBuilder.forTarget(serviceUri) .nameResolverFactory(new ServiceNameResolverProvider().toFactory()); } else { NameResolverFactoryProvider provider; try { provider = ReflectionUtils.newInstance( BK_REG_NAME_RESOLVER_PROVIDER, NameResolverFactoryProvider.class); } catch (RuntimeException re) { log.error("It seems that you don't have `bk-grpc-name-resolver` in your class path." + " Please make sure you include it as your application's dependency."); throw re; } builder = ManagedChannelBuilder.forTarget(serviceUri) .nameResolverFactory(provider.toFactory()); } if (settings.usePlaintext()) { builder = builder.usePlaintext(); } return builder; } private  GrpcChannels(); static ManagedChannelBuilder createChannelBuilder(String serviceUri,
                                                             StorageClientSettings settings);  }### Answer:
@Test public void testInprocessServiceUri() { String serviceUri = "bk+inprocess: ManagedChannelBuilder builder = GrpcChannels.createChannelBuilder( serviceUri, StorageClientSettings.newBuilder().serviceUri(serviceUri).build() ); assertTrue(builder instanceof InProcessChannelBuilder); }
@Test public void testBKServiceUri() { String serviceUri = "bk: ManagedChannelBuilder builder = GrpcChannels.createChannelBuilder( serviceUri, StorageClientSettings.newBuilder().serviceUri(serviceUri).build() ); assertTrue(builder instanceof NettyChannelBuilder); }
@Test public void testZKServiceUri() { String serviceUri = "zk: try { GrpcChannels.createChannelBuilder( serviceUri, StorageClientSettings.newBuilder().serviceUri(serviceUri).build() ); fail("Should fail to create grpc channel because `bk-grpc-name-resolver` is not in the classpath"); } catch (RuntimeException re) { assertTrue(re.getCause() instanceof ClassNotFoundException); } }