@Test
  public void testDropTimeoutRequest() throws Exception {
    // Simulate the situation that the server is slow and client retries for several times because
    // of timeout. When a request can be handled after waiting in the queue, we will drop it if
    // it has been considered as timeout at client. If we don't drop it, the server will waste time
    // on handling timeout requests and finally all requests timeout and client throws exception.
    TableDescriptorBuilder builder =
      TableDescriptorBuilder.newBuilder(TableName.valueOf(name.getMethodName()));
    builder.setCoprocessor(SleepLongerAtFirstCoprocessor.class.getName());
    ColumnFamilyDescriptor cfd = ColumnFamilyDescriptorBuilder.newBuilder(FAM_NAM).build();
    builder.setColumnFamily(cfd);
    TableDescriptor td = builder.build();
    try (Admin admin = TEST_UTIL.getConnection().getAdmin()) {
      admin.createTable(td);
    }
    TableBuilder tb = TEST_UTIL.getConnection().getTableBuilder(td.getTableName(), null);
    tb.setReadRpcTimeout(SleepLongerAtFirstCoprocessor.SLEEP_TIME * 2);
    tb.setWriteRpcTimeout(SleepLongerAtFirstCoprocessor.SLEEP_TIME * 2);
    try (Table table = tb.build()) {
      table.get(new Get(FAM_NAM));
    }
  }
Coprocessor that sleeps a while the first time you do a Get
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestDropTimeoutRequest.java