@Test(expected = IOException.class)
  public void testBulkLoadPhaseFailure() throws Exception {
    final TableName table = TableName.valueOf(name.getMethodName());
    final AtomicInteger attemptedCalls = new AtomicInteger();
    Configuration conf = new Configuration(util.getConfiguration());
    conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);
    BulkLoadHFilesTool loader = new BulkLoadHFilesTool(conf) {

      @Override
      protected void bulkLoadPhase(AsyncClusterConnection conn, TableName tableName,
        Deque<LoadQueueItem> queue, Multimap<ByteBuffer, LoadQueueItem> regionGroups,
        boolean copyFiles, Map<LoadQueueItem, ByteBuffer> item2RegionMap) throws IOException {
        AsyncClusterConnection c =
          attemptedCalls.incrementAndGet() == 1 ? mockAndInjectError(conn) : conn;
        super.bulkLoadPhase(c, tableName, queue, regionGroups, copyFiles, item2RegionMap);
      }
    };
    Path dir = buildBulkFiles(table, 1);
    loader.bulkLoad(table, dir);
  }
Test that shows that exception thrown from the RS side will result in an exception on the
LIHFile client.
hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestBulkLoadHFilesSplitRecovery.java