@Test
  public void testGetConnectionRegistry() throws IOException, ServiceException {
    Configuration clientConf = new Configuration(CONF);
    String clusterId = "test_cluster_id";
    HBaseServerBase<?> server = mock(HBaseServerBase.class);
    when(server.getClusterId()).thenReturn(clusterId);
    // do not need any services
    RpcServer rpcServer = createRpcServer(server, "testRpcServer", Collections.emptyList(),
      new InetSocketAddress("localhost", 0), CONF, new FifoRpcScheduler(CONF, 1));
    try (AbstractRpcClient<?> client = createRpcClient(clientConf)) {
      rpcServer.start();
      InetSocketAddress addr = rpcServer.getListenerAddress();
      BlockingRpcChannel channel =
        client.createBlockingRpcChannel(ServerName.valueOf(addr.getHostName(), addr.getPort(),
          EnvironmentEdgeManager.currentTime()), User.getCurrent(), 0);
      ConnectionRegistryService.BlockingInterface stub =
        ConnectionRegistryService.newBlockingStub(channel);
      GetConnectionRegistryResponse resp =
        stub.getConnectionRegistry(null, GetConnectionRegistryRequest.getDefaultInstance());
      assertEquals(clusterId, resp.getClusterId());
    }
  }
Testcase for getting connection registry information through connection preamble header, see
HBASE-25051 for more details.
hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java