code: private String getSessionOutcomeMessage(Session session, boolean isConnectionLost) throws InterruptedException {
          session.waitForCondition(ChannelCondition.EXIT_STATUS | ChannelCondition.EXIT_SIGNAL, 3000);
  
          Integer exitCode = session.getExitStatus();
          if (exitCode != null)
              return "Slave JVM has terminated. Exit code=" + exitCode;
  
          String sig = session.getExitSignal();
          if (sig != null)
              return "Slave JVM has terminated. Exit signal=" + sig;
  
          if (isConnectionLost)
              return "Slave JVM has not reported exit code before the socket was lost";
  
          return "Slave JVM has not reported exit code. Is it still running?";
      }
docs: Find the exit code or exit status, which are differentiated in SSH protocol.