private SpanData waitSpan(Matcher<SpanData> matcher) {
    Waiter.waitFor(CONF, 1000,
      new MatcherPredicate<>(() -> traceRule.getSpans(), hasItem(matcher)));
    return traceRule.getSpans().stream().filter(matcher::matches).findFirst()
      .orElseThrow(AssertionError::new);
  }
Tests that the connection closing is handled by the client with outstanding RPC calls
hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java