code: @Override
      public void read(final Connection conn, final Readline readline) {
          // In case there is some collected ouput from previous command execution
          shell.printCollectedOutput();
  
          if(running) {
              readline.readline(conn, prompt, line -> {
                  if (line != null && line.trim().length() > 0) {
                      shell.startCollectOutput();
                      processLine(line, conn);
                  }
                  else
                      read(conn, readline);
              }, completions, preProcessors, history, null, readlineFlags);
          }
          // Just call readline and get a callback when line is startBlockingReader
          else {
              LOGGER.info("not running, returning");
              conn.close();
              if (settings.quitHandler() != null)
                  settings.quitHandler().quit();
          }
       }
docs: Use {@link Readline} to startBlockingReader a user input and then process it
  
  @param conn the tty connection
  @param readline the readline object