'This will connect to the server, and if the features tag is found then set
the namespace to be jabber:client as that is required for jabberd2.
\'server\' and \'proxy\' arguments have the same meaning as in xmpp.Client.connect()'

def connect(self, server=None, proxy=None):

    if self.sasl:
        self.Namespace = auth.NS_COMPONENT_1
        self.Server = server[0]
    CommonClient.connect(self, server=server, proxy=proxy)
    if (self.connected and ((self.typ == 'jabberd2') or ((not self.typ) and (self.Dispatcher.Stream.features != None))) and (not self.xcp)):
        self.defaultNamespace = auth.NS_CLIENT
        self.Dispatcher.RegisterNamespace(self.defaultNamespace)
        self.Dispatcher.RegisterProtocol('iq', dispatcher.Iq)
        self.Dispatcher.RegisterProtocol('message', dispatcher.Message)
        self.Dispatcher.RegisterProtocol('presence', dispatcher.Presence)
    return self.connected
