'Initialize an XMPP client or component using a dummy XML stream.
Arguments:
mode     -- Either \'client\' or \'component\'. Defaults to \'client\'.
skip     -- Indicates if the first item in the sent queue (the
stream header) should be removed. Tests that wish
to test initializing the stream should set this to
False. Otherwise, the default of True should be used.
socket   -- Either \'mock\' or \'live\' to indicate if the socket
should be a dummy, mock socket or a live, functioning
socket. Defaults to \'mock\'.
jid      -- The JID to use for the connection.
Defaults to \'tester@localhost\'.
password -- The password to use for the connection.
Defaults to \'test\'.
server   -- The name of the XMPP server. Defaults to \'localhost\'.
port     -- The port to use when connecting to the server.
Defaults to 5222.
plugins  -- List of plugins to register. By default, all plugins
are loaded.'

def stream_start(self, mode='client', skip=True, header=None, socket='mock', jid='tester@localhost', password='test', server='localhost', port=5222, sasl_mech=None, plugins=None, plugin_config=None):

    if (not plugin_config):
        plugin_config = {}
    if (mode == 'client'):
        self.xmpp = ClientXMPP(jid, password, sasl_mech=sasl_mech, plugin_config=plugin_config)
    elif (mode == 'component'):
        self.xmpp = ComponentXMPP(jid, password, server, port, plugin_config=plugin_config)
    else:
        raise ValueError('Unknown    XMPP    connection    mode.')
    self.xmpp._id_prefix = ''
    self.xmpp._disconnect_wait_for_threads = False
    self.xmpp.default_lang = None
    self.xmpp.peer_default_lang = None
    skip_queue = Queue()
    if (socket == 'mock'):
        self.xmpp.set_socket(TestSocket())
        self.xmpp.auto_reconnect = False
        self.xmpp.state._set_state('connected')
        if (not header):
            header = self.xmpp.stream_header
        self.xmpp.socket.recv_data(header)
    elif (socket == 'live'):
        self.xmpp.socket_class = TestLiveSocket
        def wait_for_session(x):
            self.xmpp.socket.clear()
            skip_queue.put('started')
        self.xmpp.add_event_handler('session_start', wait_for_session)
        if (server is not None):
            self.xmpp.connect((server, port))
        else:
            self.xmpp.connect()
    else:
        raise ValueError('Unknown    socket    type.')
    if (plugins is None):
        self.xmpp.register_plugins()
    else:
        for plugin in plugins:
            self.xmpp.register_plugin(plugin)
    self.xmpp.use_message_ids = False
    self.xmpp.process(threaded=True)
    if skip:
        if (socket != 'live'):
            self.xmpp.session_bind_event.set()
            self.xmpp.session_started_event.set()
            self.xmpp.socket.next_sent(timeout=1)
            if (mode == 'component'):
                self.xmpp.socket.next_sent(timeout=1)
        else:
            skip_queue.get(block=True, timeout=10)
