code: public boolean reboot() {
          if (!sendCommand("reboot")) {
              return false;
          }
  
          // wait 1 second
          try {
              Thread.sleep(1000);
          } catch (InterruptedException ex) {
          }
  
          disconnect();
  
          // check that remote host is not accessible anymore
          // open a socket without any parameters. It hasn't been binded or connected
          try (Socket socket = new Socket()) {
              // bind to a local ephemeral port
              socket.bind(null);
              socket.connect(new InetSocketAddress(remoteHost, RLoginClient.DEFAULT_PORT), 1);
          } catch (SocketTimeoutException e) {
              logger.info("Rebooted host " + remoteHost + " successfully");
              return true;
          } catch (IOException e) {
              logger.error("Something went wrong while rebooting host:" + remoteHost);
              return false;
          }
          // Expected to get an exception as the remote host should not be reachable anymore
          logger.error(
                "Host " + remoteHost + " did not reboot as expected! Please check that no other rlogin client is connected!");
          return false;
      }
docs: Reboot the remote host by sending the reboot command and check that
  the remote host is not accessible anymore.
  
  @return true if success, false otherwise