BROKEN COMMIT. Majority of code to handle closing has been added. Listeners do not close correctly.
2 # Tests the closing negotiation facilities of the BLIP 1.1 protocol
4 from BLIP import Listener
10 class CloseTestPong(unittest.TestCase):
12 def shouldClose(self):
13 logging.info("Allowed to close.")
16 def handleConnection(self, conn):
17 logging.info("Accepted connection.")
18 conn.onCloseRequest = self.shouldClose
20 def handleRequest(self, req):
26 listen = Listener(1337)
27 listen.onConnected = self.handleConnection
28 listen.onRequest = self.handleRequest
32 except KeyboardInterrupt:
36 if __name__ == '__main__':
37 logging.basicConfig(level=logging.DEBUG)