@Test(expected = DoNotRetryIOException.class)
  public void testClosedConnection() throws ServiceException, Throwable {
    byte[] family = Bytes.toBytes("cf");
    TableName tableName = TableName.valueOf(name.getMethodName());
    TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName)
      .setCoprocessor(MultiRowMutationEndpoint.class.getName())
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(family));
    TEST_UTIL.getAdmin().createTable(builder.build());

    Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
    // cache the location
    try (Table table = conn.getTable(tableName)) {
      table.get(new Get(Bytes.toBytes(0)));
    } finally {
      conn.close();
    }
    Batch.Call<MultiRowMutationService, MutateRowsResponse> callable = service -> {
      throw new RuntimeException("Should not arrive here");
    };
    conn.getTable(tableName).coprocessorService(MultiRowMutationService.class,
      HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW, callable);
  }
Trivial test to verify that nobody messes with
{@link ConnectionFactory#createConnection(Configuration)}
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnection.java