code: void trackFailure(@Nullable IOException e) {
      assert (!Thread.holdsLock(connectionPool));
      synchronized (connectionPool) {
        if (e instanceof StreamResetException) {
          ErrorCode errorCode = ((StreamResetException) e).errorCode;
          if (errorCode == ErrorCode.REFUSED_STREAM) {
            // Retry REFUSED_STREAM errors once on the same connection.
            refusedStreamCount++;
            if (refusedStreamCount > 1) {
              noNewExchanges = true;
              routeFailureCount++;
            }
          } else if (errorCode != ErrorCode.CANCEL) {
            // Keep the connection for CANCEL errors. Everything else wants a fresh connection.
            noNewExchanges = true;
            routeFailureCount++;
          }
        } else if (!isMultiplexed() || e instanceof ConnectionShutdownException) {
          noNewExchanges = true;
  
          // If this route hasn't completed a call, avoid it for new connections.
          if (successCount == 0) {
            if (e != null) {
              connectionPool.connectFailed(route, e);
            }
            routeFailureCount++;
          }
        }
      }
    }
docs: Track a failure using this connection. This may prevent both the connection and its route from
  being used for future exchanges.