# Path: wokkel/client.py
# class CheckAuthInitializer(object):
# class HybridAuthenticator(xmlstream.ConnectAuthenticator):
# class XMPPClient(StreamManager, service.Service):
# class DeferredClientFactory(generic.DeferredXmlStreamFactory):
# class XMPPClientConnector(SRVConnector):
#     def __init__(self, xs):
#     def initialize(self):
#     def __init__(self, jid, password):
#     def associateWithStream(self, xs):
# def HybridClientFactory(jid, password):
#     def __init__(self, jid, password, host=None, port=5222):
#     def startService(self):
#     def stopService(self):
#     def _authd(self, xs):
#     def initializationFailed(self, reason):
#     def _getConnection(self):
#     def __init__(self, jid, password):
#     def addHandler(self, handler):
#     def removeHandler(self, handler):
#     def __init__(self, reactor, domain, factory):
#     def pickServer(self):
# def clientCreator(factory):


from twisted.internet import defer
from twisted.trial import unittest
from twisted.words.protocols.jabber import xmlstream
from twisted.words.protocols.jabber.client import XMPPAuthenticator
from twisted.words.protocols.jabber.jid import JID
from twisted.words.protocols.jabber.xmlstream import STREAM_AUTHD_EVENT
from twisted.words.protocols.jabber.xmlstream import INIT_FAILED_EVENT
from twisted.words.protocols.jabber.xmlstream import XMPPHandler
from wokkel import client
        """
        handler = XMPPHandler()
        handler.setHandlerParent(self.factory.streamManager)
        self.assertIn(handler, self.factory.streamManager)
        self.assertIdentical(self.factory.streamManager, handler.parent)


    def test_removeHandler(self):
        """
        Test removal of a protocol handler.
        """
        handler = XMPPHandler()
        handler.setHandlerParent(self.factory.streamManager)
        handler.disownHandlerParent(self.factory.streamManager)
        self.assertNotIn(handler, self.factory.streamManager)
        self.assertIdentical(None, handler.parent)



class ClientCreatorTest(unittest.TestCase):
    """
    Tests for L{client.clientCreator}.
    """

    def test_call(self):
        """
        The factory is passed to an SRVConnector and a connection initiated.
        """

        d1 = defer.Deferred()

# Path: wokkel/client.py
# class CheckAuthInitializer(object):
# class HybridAuthenticator(xmlstream.ConnectAuthenticator):
# class XMPPClient(StreamManager, service.Service):
# class DeferredClientFactory(generic.DeferredXmlStreamFactory):
# class XMPPClientConnector(SRVConnector):
#     def __init__(self, xs):
#     def initialize(self):
#     def __init__(self, jid, password):
#     def associateWithStream(self, xs):
# def HybridClientFactory(jid, password):
#     def __init__(self, jid, password, host=None, port=5222):
#     def startService(self):
#     def stopService(self):
#     def _authd(self, xs):
#     def initializationFailed(self, reason):
#     def _getConnection(self):
#     def __init__(self, jid, password):
#     def addHandler(self, handler):
#     def removeHandler(self, handler):
#     def __init__(self, reactor, domain, factory):
#     def pickServer(self):
# def clientCreator(factory):


# Path: wokkel/test/test_client.py
from twisted.internet import defer
from twisted.trial import unittest
from twisted.words.protocols.jabber import xmlstream
from twisted.words.protocols.jabber.client import XMPPAuthenticator
from twisted.words.protocols.jabber.jid import JID
from twisted.words.protocols.jabber.xmlstream import STREAM_AUTHD_EVENT
from twisted.words.protocols.jabber.xmlstream import INIT_FAILED_EVENT
from twisted.words.protocols.jabber.xmlstream import XMPPHandler
from wokkel import client

        """
        handler = XMPPHandler()
        handler.setHandlerParent(self.factory.streamManager)
        self.assertIn(handler, self.factory.streamManager)
        self.assertIdentical(self.factory.streamManager, handler.parent)


    def test_removeHandler(self):
        """
        Test removal of a protocol handler.
        """
        handler = XMPPHandler()
        handler.setHandlerParent(self.factory.streamManager)
        handler.disownHandlerParent(self.factory.streamManager)
        self.assertNotIn(handler, self.factory.streamManager)
        self.assertIdentical(None, handler.parent)



class ClientCreatorTest(unittest.TestCase):
    """
    Tests for L{client.clientCreator}.
    """

    def test_call(self):
        """
        The factory is passed to an SRVConnector and a connection initiated.
        """

        d1 = defer.Deferred()

        factory = client.DeferredClientFactory(JID('user@example.org'),