# Path: sio/protocol/rpc.py
# class TimeoutError(Exception):
# class ProtocolError(Exception):
# class RemoteError(Exception):
# class NoSuchMethodError(RemoteError):
# class WorkerRPC(NetstringReceiver):
#     def __init__(self, err, tb=None, uid=None):
#     def __init__(self, err=None, uid=None):
# def makeRemoteException(msg, uid=None):
#     def __init__(self, server=False, timeout=DEFAULT_TIMEOUT):
#     def connectionMade(self):
#     def connectionLost(self, reason):
#     def _processMessage(self, msg):
#     def getHelloData(self):
#     def stringReceived(self, string):
#     def _reply(self, value, request=None):
#     def _replyError(self, err, request=None):
#     def _timeout(self, rid):
#     def sendMsg(self, msg_type, **kwargs):
#     def call(self, cmd, *args, **kwargs):
#         def cb(ignore):
#     MAX_LENGTH = 2 ** 20  # 1MB should be enough
#     DEFAULT_TIMEOUT = 30
# 
# Path: sio/workers/util.py
# def json_dumps(obj, **kwargs):
#     """Python 3 and 2 compatible json.dump."""
#     kwargs.setdefault('cls', CompatibleJSONEncoder)
#     return json.dumps(obj, **kwargs)


from twisted.trial import unittest
from twisted.test import proto_helpers
from twisted.internet import protocol, reactor
from sio.protocol import rpc
from sio.workers.util import json_dumps
import json
from __future__ import absolute_import



class TestClient(rpc.WorkerRPC):
    def __init__(self):
        rpc.WorkerRPC.__init__(self, server=False)

    def doSomething(self, x):
        return self.call('foo', x)


class TestClientFactory(protocol.Factory):
    protocol = TestClient


class TestServer(rpc.WorkerRPC):
    def __init__(self):
        rpc.WorkerRPC.__init__(self, server=True)

    def cmd_mul3(self, x):
        return x * 3


class TestServerFactory(protocol.Factory):

# Path: sio/protocol/rpc.py
# class TimeoutError(Exception):
# class ProtocolError(Exception):
# class RemoteError(Exception):
# class NoSuchMethodError(RemoteError):
# class WorkerRPC(NetstringReceiver):
#     def __init__(self, err, tb=None, uid=None):
#     def __init__(self, err=None, uid=None):
# def makeRemoteException(msg, uid=None):
#     def __init__(self, server=False, timeout=DEFAULT_TIMEOUT):
#     def connectionMade(self):
#     def connectionLost(self, reason):
#     def _processMessage(self, msg):
#     def getHelloData(self):
#     def stringReceived(self, string):
#     def _reply(self, value, request=None):
#     def _replyError(self, err, request=None):
#     def _timeout(self, rid):
#     def sendMsg(self, msg_type, **kwargs):
#     def call(self, cmd, *args, **kwargs):
#         def cb(ignore):
#     MAX_LENGTH = 2 ** 20  # 1MB should be enough
#     DEFAULT_TIMEOUT = 30
# 
# Path: sio/workers/util.py
# def json_dumps(obj, **kwargs):
#     """Python 3 and 2 compatible json.dump."""
#     kwargs.setdefault('cls', CompatibleJSONEncoder)
#     return json.dumps(obj, **kwargs)


# Path: sio/protocol/tests.py
from twisted.trial import unittest
from twisted.test import proto_helpers
from twisted.internet import protocol, reactor
from sio.protocol import rpc
from sio.workers.util import json_dumps
import json

from __future__ import absolute_import



class TestClient(rpc.WorkerRPC):
    def __init__(self):
        rpc.WorkerRPC.__init__(self, server=False)

    def doSomething(self, x):
        return self.call('foo', x)


class TestClientFactory(protocol.Factory):
    protocol = TestClient


class TestServer(rpc.WorkerRPC):
    def __init__(self):
        rpc.WorkerRPC.__init__(self, server=True)

    def cmd_mul3(self, x):
        return x * 3


class TestServerFactory(protocol.Factory):

    protocol = TestServer