* 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 Connection, OutgoingRequest
10 class CloseTestPing(unittest.TestCase):
12 def handleCloseRefusal(self, resp):
13 logging.info("Close request was refused!")
16 self.connection = Connection( ('localhost', 1337) )
17 self.connection.onCloseRefused = self.handleCloseRefusal
19 def handleResponse(self, resp):
20 logging.info("Got response...")
23 req = OutgoingRequest(self.connection, "Ping")
24 req.response.onComplete = self.handleResponse
27 asyncore.loop(timeout=0, count=5) # give things time to send
29 self.connection.close()
34 if __name__ == '__main__':
35 logging.basicConfig(level=logging.INFO)