code: public ResponseOnSingeRequest executeAndGenResponse(ChannelExec channel) {
          ResponseOnSingeRequest sshResponse = new ResponseOnSingeRequest();
  
          InputStream in = null;
          OutputStream outputStreamStdErr = new ByteArrayOutputStream();
          StringBuilder sbStdOut = new StringBuilder();
          try {
  
              in = channel.getInputStream();
              channel.setErrStream(outputStreamStdErr);
  
              byte[] tmp = new byte[ParallecGlobalConfig.sshBufferSize];
              while (true) {
                  while (in.available() > 0) {
                      int i = in.read(tmp, 0, ParallecGlobalConfig.sshBufferSize);
                      if (i < 0)
                          break;
                      sbStdOut.append(new String(tmp, 0, i));
  
                  }
  
                  if (channel.isClosed()) {
                      if (in.available() > 0)
                          continue;
                      sshResponse.setFailObtainResponse(false);
  
                      // exit 0 is good
                      int exitStatus = channel.getExitStatus();
                      sshResponse.setStatusCodeInt(exitStatus);
                      sshResponse.setStatusCode(Integer.toString(exitStatus));
                      break;
                  }
  
                  Thread.sleep(ParallecGlobalConfig.sshSleepMIllisBtwReadBuffer);
              }
  
              sshResponse.setResponseBody(sbStdOut.toString());
              sshResponse.setErrorMessage(outputStreamStdErr.toString());
              sshResponse.setReceiveTimeNow();
          } catch (Exception t) {
              throw new RuntimeException(t);
          }
  
          return sshResponse;
      }
docs: Seems there are bad naming in the library the sysout is in
  channel.getInputStream(); the syserr is in
  ((ChannelExec)channel).setErrStream(os);
  
  @param channel
  the channel
  @return the response on singe request