code: public void disconnect() {
          try {
              if (client.isConnected()) {
                  client.disconnect();
              }
              if (standardInputReaderThread != null) {
                  standardInputReaderThread = null;
              }
              if (outputReaderThread != null) {
                  outputReaderThread.join();
                  outputReaderThread = null;
              }
              writer = null;
          } catch (InterruptedException ex) {
          } catch (IOException e) {
              logger.fatal("Error while disconnecting from rlogin session. Host: " + remoteHost, e);
          }
      }
docs: Disconnect the rlogin client from the remote host.