* The BLIPConnection receivedRequest: delegate method now returns BOOL. If the method returns NO (or if the method isn't implemented in the delegate), that means it didn't handle the message at all; an error will be returned to the sender.
* If the connection closes unexpectedly due to an error, then the auto-generated responses to pending requests will contain that error. This makes it easier to display a meaningful error message in the handler for the request.
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.INFO)