Channel channel = connectSession.openChannel(CMD_EXEC);
((ChannelExec)channel).setCommand(command);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(channel.getInputStream()));
logger.debug("connecting channel.");
channel.connect();
// Seems like Gerrit does not like when you disconnect directly after the command has been sent.
// For instance, we have seen effects of mails not being sent out. This is the reason for
// receiving all the incoming data.
String incomingLine = null;