private void retryConnect() {
    if (retryInProgress.getAndSet(true) == FALSE) {
      stop();
      updateSSLProtocol(); // switch from ssl:true to ssl:false and vice-versa
      LOG.info("Attempting to reconnect to ethstats server in approximately 10 seconds.");
      protocolManager
          .ethContext()
          .getScheduler()
          .scheduleFutureTask(this::start, Duration.ofSeconds(10));
    }
  }
Ends the current connection and restart a new one.
ethereum/ethstats/src/main/java/org/hyperledger/besu/ethstats/EthStatsService.java