private void runCoprocessorConnectionToRemoteTable(Class<?> clazz, boolean[] completeCheck)
    throws Throwable {
    // Check if given class implements RegionObserver.
    assert (RegionObserver.class.isAssignableFrom(clazz));
    // add our coprocessor
    TableDescriptor primaryDescriptor = TableDescriptorBuilder.newBuilder(primaryTable)
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(family)).setCoprocessor(clazz.getName())
      .build();

    TableDescriptor otherDescriptor = TableDescriptorBuilder.newBuilder(otherTable)
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(family)).build();

    Admin admin = UTIL.getAdmin();
    admin.createTable(primaryDescriptor);
    admin.createTable(otherDescriptor);

    Table table = UTIL.getConnection().getTable(TableName.valueOf("primary"));
    Put p = new Put(new byte[] { 'a' });
    p.addColumn(family, null, new byte[] { 'a' });
    table.put(p);
    table.close();

    Table target = UTIL.getConnection().getTable(otherTable);
    assertTrue("Didn't complete update to target table!", completeCheck[0]);
    assertEquals("Didn't find inserted row", 1, getKeyValueCount(target));
    target.close();
  }
@return a pool that has one thread only at every time. A second action added to the pool (
        running concurrently), will cause an exception.
hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestOpenTableInCoprocessor.java