Ejemplo n.º 1
0
 def setUp(self):
     self.channel = DummyChannel()
     request = Request(self.channel, False)
     transport = WebSocketHybiTransport(request)
     handler = TestHandler(transport)
     transport._attachHandler(handler)
     self.decoder = WebSocketHybiFrameDecoder(request, handler)
     self.decoder.MAX_LENGTH = 100
     self.decoder.MAX_BINARY_LENGTH = 1000
     # taken straight from the IETF draft, masking added where appropriate
     self.hello = "\x81\x85\x37\xfa\x21\x3d\x7f\x9f\x4d\x51\x58"
     self.frag_hello = ("\x01\x83\x12\x21\x65\x23\x5a\x44\x09",
                        "\x80\x82\x63\x34\xf1\x00\x0f\x5b")
     self.binary_orig = "\x3f" * 256
     self.binary = ("\x82\xfe\x01\x00\x12\x6d\xa6\x23" +
                    "\x2d\x52\x99\x1c" * 64)
     self.ping = "\x89\x85\x56\x23\x88\x23\x1e\x46\xe4\x4f\x39"
     self.pong = "\x8a\x85\xde\x41\x0f\x34\x96\x24\x63\x58\xb1"
     self.pong_unmasked = "\x8a\x05\x48\x65\x6c\x6c\x6f"
     # code 1000, message "Normal Closure"
     self.close = ("\x88\x90\x34\x23\x87\xde\x37\xcb\xc9\xb1\x46"
                   "\x4e\xe6\xb2\x14\x60\xeb\xb1\x47\x56\xf5\xbb")
     self.empty_unmasked_close = "\x88\x00"
     self.empty_text = "\x81\x80\x00\x01\x02\x03"
     self.cont_empty_text = "\x00\x80\x00\x01\x02\x03"
Ejemplo n.º 2
0
 def setUp(self):
     self.channel = DummyChannel()
     self.request = request = Request(self.channel, False)
     # Simulate request handling
     request.startedWriting = True
     transport = WebSocketHybiTransport(request)
     self.handler = TestHandler(transport)
     transport._attachHandler(self.handler)