code: private void startAgent(SlaveComputer computer, final TaskListener listener, String java,
                              String workingDirectory) throws IOException {
          session = connection.openSession();
          expandChannelBufferSize(session,listener);
          String cmd = "cd \"" + workingDirectory + "\" && " + java + " " + getJvmOptions() + " -jar " + AGENT_JAR +
                       getWorkDirParam(workingDirectory);
  
          //This will wrap the cmd with prefix commands and suffix commands if they are set.
          cmd = getPrefixStartSlaveCmd() + cmd + getSuffixStartSlaveCmd();
  
          listener.getLogger().println(Messages.SSHLauncher_StartingAgentProcess(getTimestamp(), cmd));
          session.execCommand(cmd);
  
          session.pipeStderr(new DelegateNoCloseOutputStream(listener.getLogger()));
  
          try {
              computer.setChannel(session.getStdout(), session.getStdin(), listener.getLogger(), null);
          } catch (InterruptedException e) {
              session.close();
              throw new IOException(Messages.SSHLauncher_AbortedDuringConnectionOpen(), e);
          } catch (IOException e) {
              try {
                  // often times error this early means the JVM has died, so let's see if we can capture all stderr
                  // and exit code
                  throw new AbortException(getSessionOutcomeMessage(session,false));
              } catch (InterruptedException x) {
                  throw new IOException(e);
              }
          }
      }
docs: Starts the agent process.
  
  @param computer         The computer.
  @param listener         The listener.
  @param java             The full path name of the java executable to use.
  @param workingDirectory The working directory from which to start the java process.
  
  @throws IOException If something goes wrong.