@Test
  public void testGetConnectionRegistryError() throws IOException, ServiceException {
    Configuration clientConf = new Configuration(CONF);
    // do not need any services
    RpcServer rpcServer = createRpcServer("testRpcServer", Collections.emptyList(),
      new InetSocketAddress("localhost", 0), CONF, new FifoRpcScheduler(CONF, 1));
    try (AbstractRpcClient<?> client = createRpcClient(clientConf)) {
      rpcServer.start();
      InetSocketAddress addr = rpcServer.getListenerAddress();
      RpcChannel channel = client.createRpcChannel(ServerName.valueOf(addr.getHostName(),
        addr.getPort(), EnvironmentEdgeManager.currentTime()), User.getCurrent(), 0);
      ConnectionRegistryService.Interface stub = ConnectionRegistryService.newStub(channel);
      HBaseRpcController pcrc = new HBaseRpcControllerImpl();
      BlockingRpcCallback<GetConnectionRegistryResponse> done = new BlockingRpcCallback<>();
      stub.getConnectionRegistry(pcrc, GetConnectionRegistryRequest.getDefaultInstance(), done);
      // should have failed so no response
      assertNull(done.get());
      assertTrue(pcrc.failed());
      // should be a FatalConnectionException
      assertThat(pcrc.getFailed(), instanceOf(RemoteException.class));
      assertEquals(FatalConnectionException.class.getName(),
        ((RemoteException) pcrc.getFailed()).getClassName());
      assertThat(pcrc.getFailed().getMessage(), startsWith("Expected HEADER="));
    }
  }
Test server does not support getting connection registry information through connection
preamble header, i.e, a new client connecting to an old server. We simulate this by using a
Server without implementing the ConnectionRegistryEndpoint interface.
hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java