@Test
  public void testScannerFailsAfterRetriesWhenCoprocessorThrowsIOE()
    throws IOException, InterruptedException {
    TableName tableName = TableName.valueOf(name.getMethodName());
    reset();
    THROW_ONCE.set(false); // throw exceptions in every retry
    try (Table t = TEST_UTIL.createTable(tableName, FAMILY)) {
      TEST_UTIL.loadTable(t, FAMILY, false);
      TEST_UTIL.getAdmin().flush(tableName);
      inject();
      TEST_UTIL.countRows(t, new Scan().addColumn(FAMILY, FAMILY));
      fail("Should have thrown an exception");
    } catch (ScannerResetException expected) {
      // expected
    } catch (RetriesExhaustedException e) {
      // expected
      assertThat(e.getCause(), instanceOf(ScannerResetException.class));
    }
    assertTrue(REQ_COUNT.get() >= 3);
  }
Tests the case where a coprocessor throws a regular IOException in the scan. The expectation is
that the we will keep on retrying, but fail after the retries are exhausted instead of retrying
indefinitely.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSideScanExcpetion.java