code: public void updateStatus() {
  
      String hostaddr = null;
      try {
        hostaddr = InetAddress.getByName(ip).getHostAddress();
      } catch (UnknownHostException e) {
        online = false;
        latency = Long.MAX_VALUE;
        return;
      }
  
      int total = 0;
      long totalPing = 0;
  
      // test ping 4 times
      int times = 4;
  
      while (total < times) {
        total++;
        long start = System.currentTimeMillis();
  
        SocketAddress sockaddr = new InetSocketAddress(hostaddr, port);
        try (Socket socket = new Socket()) {
          socket.connect(sockaddr, 1000);
        } catch (Exception e) {
          online = false;
          return;
        }
  
        totalPing += (System.currentTimeMillis() - start);
      }
  
      online = true;
      latency = totalPing / total;
    }
docs: Update the proxy status