Exemplo n.º 1
0
    def test_ISockPortTaken(self):
        import threading

        try: server = isock.Server("localhost",4442)
        except isock.ServerException as error: self.fail("Init Error" + str(error))

        with self.assertRaises(isock.ServerException):
            server2 = isock.Server("localhost",4442)

        thread = threading.Thread(target=server.serve_forever)
        thread.start()
        server.shutdown()
        server.server_close()
Exemplo n.º 2
0
    def setUp(self):
        import threading

        try: self.server = isock.Server("localhost",4443)
        except isock.ServerException as error: self.fail("Init Error" + str(error))

        self.thread = threading.Thread(target=self.server.serve_forever)
        self.thread.start()
Exemplo n.º 3
0
    def setUp(self):
        import threading

        try: self.server = isock.Server("localhost",4440)
        except isock.ServerException as error: self.fail("Init Error" + str(error))

        self.server.addAction(_echo())

        server_variable = "dummy"
        self.server.addAction(_serverVar(server_variable))

        self.thread = threading.Thread(target=self.server.serve_forever)
        self.thread.start()
Exemplo n.º 4
0
    def test_ISockServerException(self):
        import threading

        try: server = isock.Server("localhost",4441)
        except isock.ServerException as error: self.fail("Init Error" + str(error))

        server.addAction(_echo())

        with self.assertRaises(isock.ServerException):
            server.addAction(_echo())

        with self.assertRaises(isock.ServerException):
            server.addAction(_notAction1())

        with self.assertRaises(isock.ServerException):
            server.addAction(_notAction2())

        thread = threading.Thread(target=server.serve_forever)
        thread.start()

        server.shutdown()
        server.server_close()