code: private boolean validateNoLoopDetected(DefaultHttpSession acceptSession) {
          List<String> viaHeaders = acceptSession.getReadHeaders(HEADER_VIA);
          if (viaHeaders != null && viaHeaders.stream().anyMatch(h -> h.equals(viaHeader))) {
                  LOGGER.warn("Connection to " + getConnectURIs().iterator().next() +
                          " failed due to loop detection [" + acceptSession + "->]");
                  acceptSession.setStatus(HttpStatus.SERVER_LOOP_DETECTED);
                  acceptSession.close(true);
                  return false;
              }
          return true;
      }
docs: Helper method performing loop detection
  @param acceptSession - session parameter
  @return - whether a loop was detected or not