@Test
  public void testRejectRequestsOnAbort() throws Exception {
    // We don't want to disrupt the server carrying meta, because we plan to disrupt requests to
    // the server. Disrupting meta requests messes with the test.
    HRegionServer serverWithoutMeta = null;
    for (JVMClusterUtil.RegionServerThread regionServerThread : UTIL.getMiniHBaseCluster()
      .getRegionServerThreads()) {
      HRegionServer regionServer = regionServerThread.getRegionServer();
      if (
        regionServer.getRegions(TableName.META_TABLE_NAME).isEmpty()
          && !regionServer.getRegions(TABLE_NAME).isEmpty()
      ) {
        serverWithoutMeta = regionServer;
        break;
      }
    }

    assertNotNull("couldn't find a server without meta, but with test table regions",
      serverWithoutMeta);

    Thread writer = new Thread(getWriterThreadRunnable(serverWithoutMeta.getServerName()));
    writer.setDaemon(true);
    writer.start();

    // Trigger the abort. Our WriterThread will detect the first RegionServerAbortedException
    // and trigger our custom queue to reject any more requests. This would typically result in
    // CallQueueTooBigException, unless our logic in ServerRpcConnection to preempt the processing
    // of a request is working.
    serverWithoutMeta.abort("Abort RS for test");

    UTIL.waitFor(60_000, () -> THROWN_EXCEPTION.get() != null);
    assertEquals(THROWN_EXCEPTION.get().getCause().getClass(), RegionServerAbortedException.class);
  }
Tests that the logic in ServerRpcConnection works such that if the server is aborted, it short
circuits any other logic. This means we no longer even attempt to enqueue the request onto the
call queue. We verify this by using a special call queue which we can trigger to always return
CallQueueTooBigException. If the logic works, despite forcing those exceptions, we should not
see them.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerRejectDuringAbort.java