'Given a secured SSH connection, try to execute a command in a new
channel created on it and associate the result with a protocol from the
given factory.
@param connection: See L{SSHCommandClientEndpoint.existingConnection}\'s
C{connection} parameter.
@param protocolFactory: See L{SSHCommandClientEndpoint.connect}\'s
C{protocolFactory} parameter.
@return: See L{SSHCommandClientEndpoint.connect}\'s return value.'

def _executeCommand(self, connection, protocolFactory):

    commandConnected = Deferred()
    def disconnectOnFailure(passthrough):
        immediate = passthrough.check(CancelledError)
        self._creator.cleanupConnection(connection, immediate)
        return passthrough
    commandConnected.addErrback(disconnectOnFailure)
    channel = _CommandChannel(self._creator, self._command, protocolFactory, commandConnected)
    connection.openChannel(channel)
    return commandConnected
