Ejemplo n.º 1
0
    def testStartServerWithSettings(self):
        settings = {
            "round_trip_latency_ms": 100,
            "download_bandwidth_kbps": 5000,
            "upload_bandwidth_kbps": 2000
        }
        with ts_proxy_server.TsProxyServer(**settings) as server:
            self.assertEquals(server._rtt, 100)
            self.assertEquals(server._inkbps, 5000)
            self.assertEquals(server._outkbps, 2000)

        settings2 = {
            "round_trip_latency_ms": 1000,
            "download_bandwidth_kbps": 500,
            "upload_bandwidth_kbps": 2000
        }
        with ts_proxy_server.TsProxyServer(**settings2) as server:
            self.assertEquals(server._rtt, 1000)
            self.assertEquals(server._inkbps, 500)
            self.assertEquals(server._outkbps, 2000)
Ejemplo n.º 2
0
    def testSmokeUpdateTrafficSettings(self):
        with ts_proxy_server.TsProxyServer() as server:
            server.UpdateTrafficSettings(round_trip_latency_ms=100)
            server.UpdateTrafficSettings(download_bandwidth_kbps=5000)
            server.UpdateTrafficSettings(upload_bandwidth_kbps=2000)

            self.assertEquals(server._rtt, 100)
            self.assertEquals(server._inbkps, 5000)
            self.assertEquals(server._outkbps, 2000)

            server.UpdateTrafficSettings(round_trip_latency_ms=200,
                                         download_bandwidth_kbps=500,
                                         upload_bandwidth_kbps=2000)
            self.assertEquals(server._rtt, 200)
            self.assertEquals(server._inbkps, 500)
            self.assertEquals(server._outkbps, 2000)
Ejemplo n.º 3
0
 def __init__(self, device_proxy_port=DEFAULT_DEVICE_PORT):
     self._device_proxy_port = device_proxy_port
     self._ts_proxy_server = ts_proxy_server.TsProxyServer(PROXY_HOST_IP)
     self._wpr_server = WPRServer()
Ejemplo n.º 4
0
 def testSmokeUpdateOutboundPortsInvalid(self):
     with ts_proxy_server.TsProxyServer() as server:
         self.assertIsNotNone(server.port)
         with self.assertRaises(AssertionError):
             server.UpdateOutboundPorts(31242, 'abcde')
Ejemplo n.º 5
0
 def testSmokeUpdatingOutboundPorts(self):
     with ts_proxy_server.TsProxyServer() as server:
         self.assertIsNotNone(server.port)
         server.UpdateOutboundPorts(31242, 14220)
Ejemplo n.º 6
0
 def testSmokeStartingTsProxyServer(self):
     with ts_proxy_server.TsProxyServer() as server:
         self.assertIsNotNone(server.port)
     with ts_proxy_server.TsProxyServer(None, 37124, 37125) as server:
         self.assertIsNotNone(server.port)