Ejemplo n.º 1
0
    def setUp(self):
        yield super(AbstractTestTunnelCommunity, self).setUp()

        self.tunnel_community = HiddenTunnelCommunity(self.dispersy, self.master_member, self.member)
        self.tunnel_community._request_cache = RequestCache()
        self.tunnel_community.socks_server = Socks5Server(self, 1234)
        self.tunnel_community._initialize_meta_messages()
        self.tunnel_community.add_conversion(TunnelConversion(self.tunnel_community))
Ejemplo n.º 2
0
class AbstractTestTunnelCommunity(AbstractTestCommunity):

    # We have to initialize Dispersy and the tunnel community on the reactor thread

    @blocking_call_on_reactor_thread
    @inlineCallbacks
    def setUp(self):
        yield super(AbstractTestTunnelCommunity, self).setUp()

        self.tunnel_community = HiddenTunnelCommunity(self.dispersy, self.master_member, self.member)
        self.tunnel_community._request_cache = RequestCache()
        self.tunnel_community.socks_server = Socks5Server(self, 1234)
        self.tunnel_community._initialize_meta_messages()
        self.tunnel_community.add_conversion(TunnelConversion(self.tunnel_community))
Ejemplo n.º 3
0
    def setUp(self, autoload_discovery=True):
        yield super(TestCircuitDebugEndpoint, self).setUp(autoload_discovery=autoload_discovery)

        self.dispersy = Dispersy(ManualEnpoint(0), self.getStateDir())
        self.dispersy._database.open()
        master_member = DummyMember(self.dispersy, 1, "a" * 20)
        member = self.dispersy.get_new_member(u"curve25519")

        self.tunnel_community = HiddenTunnelCommunity(self.dispersy, master_member, member)
        self.dispersy.get_communities = lambda: [self.tunnel_community]
        self.session.get_dispersy_instance = lambda: self.dispersy
Ejemplo n.º 4
0
 def test_circuit_tunnel_data(self):
     """
     Test whether the right methods are called when tunneling data over a circuit
     """
     proxy = HiddenTunnelCommunity.__new__(HiddenTunnelCommunity)
     proxy.stats = {'bytes_up': 0}
     proxy.send_data = lambda *_: 3
     circuit = Circuit(1234L, 3, proxy=proxy, first_hop=("1.2.3.5", 1235))
     circuit.tunnel_data(("1.2.3.4", 1234), 'abcd')
     proxy.send_data = lambda *_: 0
     circuit.tunnel_data(("1.2.3.4", 1234), 'abcd')
     self.assertEqual(proxy.stats['bytes_up'], 3)