code: public void shutdown(boolean join) {
          setShutdownInProgress();
          nullifyWatchdog();
          if (sshConnection != null) {
              logger.info("Shutting down the ssh connection.");
              try {
                  sshConnection.disconnect();
              } catch (Exception ex) {
                  logger.warn("Error when disconnecting sshConnection.", ex);
              }
          }
          if (join) {
              try {
                  this.join();
              } catch (InterruptedException ex) {
                  logger.warn("Got interrupted while waiting for shutdown.", ex);
              }
          }
      }
docs: Closes the connection.
  
  @param join if the method should wait for the thread to finish before returning.