code: private void checkDrain() {
      if (full && !paused && messages.size() < maxQueueSize / 2) {
        full = false;
        log.debug(String.format("%s - Connection to %s is drained", this, context.target()));
        if (drainHandler != null) {
          drainHandler.handle((Void) null);
        }
      }
    }
docs: Checks whether the connection has been drained.