Ejemplo n.º 1
0
    def test_client_timeout(self):
        client = Client(Echoer.Client, "echo", self.serverset)
        client.client_timeout = 0.1

        self.serverset.add_server(("localhost", PORT))

        client.echo("sleep")
        client.close()
Ejemplo n.º 2
0
    def test_client_timeout(self):
        client = Client(Echoer.Client, "echo", self.serverset)
        client.client_timeout = 0.1

        self.serverset.add_server(("localhost", PORT))

        client.echo("sleep")
        client.close()
Ejemplo n.º 3
0
    def test_client_timeout_connect(self):
        client = Client(Echoer.Client, "echo", self.serverset)
        client.client_timeout = 0.1

        # Connect to unreachable host 1.1.1.1
        self.serverset.add_server(("1.1.1.1", PORT))

        t = time.time()
        try:
            client.echo("foobar")
        except:
            pass
        duration = time.time() - t
        assert_that(duration < 0.2, equal_to(True),
                    "duration: %f, should be around 0.1" % duration)
Ejemplo n.º 4
0
    def test_client_timeout_connect(self):
        client = Client(Echoer.Client, "echo", self.serverset)
        client.client_timeout = 0.1

        # Connect to unreachable host 1.1.1.1
        self.serverset.add_server(("1.1.1.1", PORT))

        t = time.time()
        try:
            client.echo("foobar")
        except:
            pass
        duration = time.time() - t
        assert_that(duration < 0.2, equal_to(True),
                    "duration: %f, should be around 0.1" % duration)