@Before
  public void setUp() throws Exception {
    switch (impl) {
      case ZK: {
        Configuration conf = HBaseConfiguration.create();
        conf.setClass(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY,
          ZKConnectionRegistry.class, ConnectionRegistry.class);
        String quorum = UTIL.getZkCluster().getAddress().toString();
        String path = UTIL.getConfiguration().get(HConstants.ZOOKEEPER_ZNODE_PARENT);
        conf.set(HConstants.CLIENT_ZOOKEEPER_QUORUM, quorum);
        conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, path);
        LOG.info("connect to cluster through zk quorum={} and parent={}", quorum, path);
        conn = ConnectionFactory.createConnection(conf);
        break;
      }
      case RPC: {
        Configuration conf = HBaseConfiguration.create();
        conf.setClass(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY,
          RpcConnectionRegistry.class, ConnectionRegistry.class);
        String bootstrapServers =
          UTIL.getMiniHBaseCluster().getMaster().getServerName().getAddress().toString();
        conf.set(RpcConnectionRegistry.BOOTSTRAP_NODES, bootstrapServers);
        LOG.info("connect to cluster through rpc bootstrap servers={}", bootstrapServers);
        conn = ConnectionFactory.createConnection(conf);
        break;
      }
      case ZK_URI: {
        String quorum = UTIL.getZkCluster().getAddress().toString();
        String path = UTIL.getConfiguration().get(HConstants.ZOOKEEPER_ZNODE_PARENT);
        URI connectionUri = new URI("hbase+zk://" + quorum + path);
        LOG.info("connect to cluster through connection url: {}", connectionUri);
        conn = ConnectionFactory.createConnection(connectionUri);
        break;
      }
      case RPC_URI: {
        URI connectionUri = new URI("hbase+rpc://"
          + UTIL.getMiniHBaseCluster().getMaster().getServerName().getAddress().toString());
        LOG.info("connect to cluster through connection url: {}", connectionUri);
        conn = ConnectionFactory.createConnection(connectionUri);
        break;
      }
      default:
        throw new IllegalArgumentException("Unknown impl: " + impl);
    }
    try (Admin admin = conn.getAdmin()) {
      admin.createTable(TableDescriptorBuilder.newBuilder(name.getTableName())
        .setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY)).build());
    }
  }
Test basic read write operation with different {@link ConnectionRegistry} implementations.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBasicReadWriteWithDifferentConnectionRegistries.java