gerrit-events/src/main/java/com/sonyericsson/hudson/plugins/gerrit/gerritevents/ssh/SshConnectionImpl.java
/**
     * This version takes a command to run, and then returns a wrapper instance
     * that exposes all the standard state of the channel (stdin, stdout,
     * stderr, exit status, etc).
     *
     * @param command the command to execute.
     * @return a Channel with access to all streams and the exit code.
     * @throws IOException  if it is so.
     * @throws SshException if there are any ssh problems.
     * @see #executeCommandReader(String)
     */
This version takes a command to run, and then returns a wrapper instance
that exposes all the standard state of the channel (stdin, stdout,
stderr, exit status, etc).

@param command the command to execute.
@return a Channel with access to all streams and the exit code.
@throws IOException  if it is so.
@throws SshException if there are any ssh problems.
This version takes a command to run and then returns a wrapper instance that exposes all the standard state of the channel ( stdin stdout stderr exit status etc ) . @param command the command to execute . @return a Channel with access to all streams and the exit code . @throws IOException if it is so . @throws SshException if there are any ssh problems .
@Override
    public synchronized ChannelExec executeCommandChannel(String command) throws SshException, IOException {
        if (!isConnected()) {
            throw new IOException("Not connected!");
        }
        try {
            ChannelExec channel = (ChannelExec)connectSession.openChannel("exec");
            channel.setCommand(command);
            channel.connect();
            return channel;
        } catch (JSchException ex) {
            throw new SshException(ex);
        }
    }
@ Override public synchronized ChannelExec executeCommandChannel ( String command ) throws SshException , IOException { if ( ! isConnected ( ) ) { throw new IOException ( "Not connected!" ) ; } try { ChannelExec channel = ( ChannelExec ) connectSession . openChannel ( "exec" ) ; channel . setCommand ( command ) ; channel . connect ( ) ; return channel ; } catch ( JSchException ex ) { throw new SshException ( ex ) ; } }
This version takes a command to run, and then returns a wrapper instance
 that exposes all the standard state of the channel (stdin, stdout,
 stderr, exit status, etc).
This version takes a command to run and then returns a wrapper instance that exposes all the standard state of the channel ( stdin stdout stderr exit status etc ) .