@Test
  public void testRaceBetweenClientAndTimeout() throws Exception {
    try {
      this.region = TEST_UTIL.createLocalHRegion(TESTTABLEDESC, null, null);
      HTestConst.addContent(this.region, HConstants.CATALOG_FAMILY);
      Scan scan = new Scan();
      InternalScanner s = region.getScanner(scan);
      List<Cell> results = new ArrayList<>();
      try {
        s.next(results);
        s.close();
        s.next(results);
        fail("We don't want anything more, we should be failing");
      } catch (UnknownScannerException ex) {
        // ok!
        return;
      }
    } finally {
      HBaseTestingUtil.closeRegionAndWAL(this.region);
    }
  }
Test that closing a scanner while a client is using it doesn't throw NPEs but instead a
UnknownScannerException. HBASE-2503
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java