def handler():
    default = binding.handler()
    def request(url, message, **kwargs):
        response = default(url, message, **kwargs)
        print "%s %s => %d (%s)" % (
            message['method'], url, response['status'], response['reason'])
        return response
    return request
    def test(self):
        global opts

        paths = [
            "/services", 
            "authentication/users", 
            "search/jobs"
        ]

        handlers = [
            binding.handler(),  # default handler
            urllib2_handler,
        ]

        for handler in handlers:
            context = binding.connect(handler=handler, **opts.kwargs)
            for path in paths:
                body = context.get(path).body.read()
                self.assertTrue(isatom(body))