Lines Matching refs:ws

13     ws = TestApplicationWebsocket()  variable in TestJavaWebsockets
26 self.ws.frame_write(sock, self.ws.OP_CLOSE, self.ws.serialize_close())
32 frame = self.ws.frame_read(sock)
35 assert frame['opcode'] == self.ws.OP_CLOSE, 'close opcode'
42 if opcode == self.ws.OP_BINARY or not decode:
54 resp, sock, key = self.ws.upgrade()
60 assert resp['headers']['Sec-WebSocket-Accept'] == self.ws.accept(
69 _, sock, _ = self.ws.upgrade()
71 self.ws.frame_write(sock, self.ws.OP_TEXT, message)
72 frame = self.ws.frame_read(sock)
76 self.ws.frame_write(sock, self.ws.OP_TEXT, message)
77 frame = self.ws.frame_read(sock)
88 _, sock, _ = self.ws.upgrade()
90 self.ws.frame_write(sock, self.ws.OP_TEXT, message, mask=False)
92 frame = self.ws.frame_read(sock)
94 assert frame['opcode'] == self.ws.OP_CLOSE, 'no mask opcode'
104 _, sock, _ = self.ws.upgrade()
106 self.ws.frame_write(sock, self.ws.OP_TEXT, message, fin=False)
107 self.ws.frame_write(sock, self.ws.OP_CONT, ' ', fin=False)
108 self.ws.frame_write(sock, self.ws.OP_CONT, message)
110 frame = self.ws.frame_read(sock)
123 _, sock, _ = self.ws.upgrade()
125 self.ws.frame_write(sock, self.ws.OP_PING, message, fin=False)
127 frame = self.ws.frame_read(sock)
135 'opcode': self.ws.OP_CLOSE,
149 _, sock1, _ = self.ws.upgrade()
150 _, sock2, _ = self.ws.upgrade()
152 self.ws.frame_write(sock1, self.ws.OP_TEXT, message1)
153 self.ws.frame_write(sock2, self.ws.OP_TEXT, message2)
155 frame1 = self.ws.frame_read(sock1)
156 frame2 = self.ws.frame_read(sock2)
174 'Sec-WebSocket-Key': self.ws.key(),
185 resp, sock, _ = self.ws.upgrade(
190 'Sec-WebSocket-Key': self.ws.key(),
207 'Sec-WebSocket-Key': self.ws.key(),
223 'Sec-WebSocket-Key': self.ws.key(),
247 key = self.ws.key()
271 'Sec-WebSocket-Key': self.ws.key(),
287 'Sec-WebSocket-Key': self.ws.key(),
304 'Sec-WebSocket-Key': self.ws.key(),
316 key = self.ws.key()
317 resp, sock, _ = self.ws.upgrade(
331 assert resp['headers']['Sec-WebSocket-Accept'] == self.ws.accept(
344 opcode = self.ws.OP_TEXT
346 _, sock, _ = self.ws.upgrade()
351 self.ws.frame_write(sock, opcode, payload, chopsize=chopsize)
353 frame = self.ws.message_read(sock)
370 opcode = self.ws.OP_BINARY
372 _, sock, _ = self.ws.upgrade()
377 self.ws.frame_write(sock, opcode, payload, chopsize=chopsize)
379 frame = self.ws.message_read(sock)
396 op_ping = self.ws.OP_PING
397 op_pong = self.ws.OP_PONG
399 _, sock, _ = self.ws.upgrade()
402 self.ws.frame_write(sock, op_ping, payload, chopsize=chopsize)
403 frame = self.ws.frame_read(sock)
417 _, sock, _ = self.ws.upgrade()
419 self.ws.frame_write(sock, self.ws.OP_PING, b'\xfe' * 126)
427 _, sock, _ = self.ws.upgrade()
429 self.ws.frame_write(sock, self.ws.OP_PONG, '')
434 self.ws.frame_write(sock, self.ws.OP_PONG, 'unsolicited pong payload')
441 self.ws.frame_write(sock, self.ws.OP_PONG, 'unsolicited pong payload')
442 self.ws.frame_write(sock, self.ws.OP_PING, payload)
444 frame = self.ws.frame_read(sock)
445 self.check_frame(frame, True, self.ws.OP_PONG, payload)
454 _, sock, _ = self.ws.upgrade()
457 self.ws.frame_write(sock, self.ws.OP_PING, 'payload-%d' % i)
460 frame = self.ws.frame_read(sock)
461 self.check_frame(frame, True, self.ws.OP_PONG, 'payload-%d' % i)
466 opcode = self.ws.OP_PING
467 self.ws.frame_write(sock, opcode, 'payload-%d' % i, chopsize=1)
470 frame = self.ws.frame_read(sock)
471 self.check_frame(frame, True, self.ws.OP_PONG, 'payload-%d' % i)
483 _, sock, _ = self.ws.upgrade()
485 self.ws.frame_write(sock, self.ws.OP_TEXT, payload, rsv1=True)
490 _, sock, _ = self.ws.upgrade()
492 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
493 self.ws.frame_write(sock, self.ws.OP_TEXT, payload, rsv2=True)
494 self.ws.frame_write(sock, self.ws.OP_PING, '')
496 frame = self.ws.frame_read(sock)
497 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
506 _, sock, _ = self.ws.upgrade()
508 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
510 frame = self.ws.frame_read(sock)
511 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
513 self.ws.frame_write(
514 sock, self.ws.OP_TEXT, payload, rsv1=True, rsv2=True
524 _, sock, _ = self.ws.upgrade()
526 self.ws.frame_write(sock, self.ws.OP_TEXT, payload, chopsize=1)
527 self.ws.frame_write(
528 sock, self.ws.OP_TEXT, payload, rsv3=True, chopsize=1
530 self.ws.frame_write(sock, self.ws.OP_PING, '')
532 frame = self.ws.frame_read(sock)
533 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
542 _, sock, _ = self.ws.upgrade()
544 self.ws.frame_write(
546 self.ws.OP_BINARY,
556 _, sock, _ = self.ws.upgrade()
558 self.ws.frame_write(
559 sock, self.ws.OP_PING, payload, rsv2=True, rsv3=True
566 _, sock, _ = self.ws.upgrade()
568 self.ws.frame_write(
569 sock, self.ws.OP_CLOSE, payload, rsv1=True, rsv2=True, rsv3=True
581 _, sock, _ = self.ws.upgrade()
583 self.ws.frame_write(sock, 0x03, '')
588 _, sock, _ = self.ws.upgrade()
590 self.ws.frame_write(sock, 0x04, 'reserved opcode payload')
595 _, sock, _ = self.ws.upgrade()
597 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
599 frame = self.ws.frame_read(sock)
600 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
602 self.ws.frame_write(sock, 0x05, '')
603 self.ws.frame_write(sock, self.ws.OP_PING, '')
609 _, sock, _ = self.ws.upgrade()
611 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
613 frame = self.ws.frame_read(sock)
614 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
616 self.ws.frame_write(sock, 0x06, payload)
617 self.ws.frame_write(sock, self.ws.OP_PING, '')
623 _, sock, _ = self.ws.upgrade()
625 self.ws.frame_write(sock, self.ws.OP_TEXT, payload, chopsize=1)
627 frame = self.ws.frame_read(sock)
628 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
630 self.ws.frame_write(sock, 0x07, payload, chopsize=1)
631 self.ws.frame_write(sock, self.ws.OP_PING, '')
637 _, sock, _ = self.ws.upgrade()
639 self.ws.frame_write(sock, 0x0B, '')
644 _, sock, _ = self.ws.upgrade()
646 self.ws.frame_write(sock, 0x0C, 'reserved opcode payload')
651 _, sock, _ = self.ws.upgrade()
653 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
655 frame = self.ws.frame_read(sock)
656 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
658 self.ws.frame_write(sock, 0x0D, '')
659 self.ws.frame_write(sock, self.ws.OP_PING, '')
665 _, sock, _ = self.ws.upgrade()
667 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
669 frame = self.ws.frame_read(sock)
670 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
672 self.ws.frame_write(sock, 0x0E, payload)
673 self.ws.frame_write(sock, self.ws.OP_PING, '')
679 _, sock, _ = self.ws.upgrade()
681 self.ws.frame_write(sock, self.ws.OP_TEXT, payload, chopsize=1)
683 frame = self.ws.frame_read(sock)
684 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
686 self.ws.frame_write(sock, 0x0F, payload, chopsize=1)
687 self.ws.frame_write(sock, self.ws.OP_PING, '')
696 _, sock, _ = self.ws.upgrade()
698 self.ws.frame_write(sock, self.ws.OP_PING, 'fragment1', fin=False)
699 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=True)
704 _, sock, _ = self.ws.upgrade()
706 self.ws.frame_write(sock, self.ws.OP_PONG, 'fragment1', fin=False)
707 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=True)
712 _, sock, _ = self.ws.upgrade()
714 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
715 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=True)
717 frame = self.ws.frame_read(sock)
718 self.check_frame(frame, True, self.ws.OP_TEXT, 'fragment1fragment2')
722 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
724 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=True)
726 frame = self.ws.frame_read(sock)
727 self.check_frame(frame, True, self.ws.OP_TEXT, 'fragment1fragment2')
731 self.ws.frame_write(
732 sock, self.ws.OP_TEXT, 'fragment1', fin=False, chopsize=1
734 self.ws.frame_write(
735 sock, self.ws.OP_CONT, 'fragment2', fin=True, chopsize=1
738 frame = self.ws.frame_read(sock)
739 self.check_frame(frame, True, self.ws.OP_TEXT, 'fragment1fragment2')
745 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
746 self.ws.frame_write(sock, self.ws.OP_PING, ping_payload)
747 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=True)
749 frame = self.ws.frame_read(sock)
750 self.check_frame(frame, True, self.ws.OP_PONG, ping_payload)
752 frame = self.ws.frame_read(sock)
753 self.check_frame(frame, True, self.ws.OP_TEXT, 'fragment1fragment2')
759 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
762 self.ws.frame_write(sock, self.ws.OP_PING, ping_payload)
764 frame = self.ws.frame_read(sock)
765 self.check_frame(frame, True, self.ws.OP_PONG, ping_payload)
767 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=True)
769 frame = self.ws.frame_read(sock)
770 self.check_frame(frame, True, self.ws.OP_TEXT, 'fragment1fragment2')
776 self.ws.frame_write(
777 sock, self.ws.OP_TEXT, 'fragment1', fin=False, chopsize=1
779 self.ws.frame_write(sock, self.ws.OP_PING, ping_payload, chopsize=1)
780 self.ws.frame_write(
781 sock, self.ws.OP_CONT, 'fragment2', fin=True, chopsize=1
784 frame = self.ws.frame_read(sock)
785 self.check_frame(frame, True, self.ws.OP_PONG, ping_payload)
787 frame = self.ws.frame_read(sock)
788 self.check_frame(frame, True, self.ws.OP_TEXT, 'fragment1fragment2')
792 self.ws.frame_write(
793 sock, self.ws.OP_CONT, 'non-continuation payload', fin=True
795 self.ws.frame_write(sock, self.ws.OP_TEXT, 'Hello, world!', fin=True)
800 _, sock, _ = self.ws.upgrade()
802 self.ws.frame_write(
803 sock, self.ws.OP_CONT, 'non-continuation payload', fin=True
805 self.ws.frame_write(sock, self.ws.OP_TEXT, 'Hello, world!', fin=True)
810 _, sock, _ = self.ws.upgrade()
812 self.ws.frame_write(
814 self.ws.OP_CONT,
819 self.ws.frame_write(
820 sock, self.ws.OP_TEXT, 'Hello, world!', fin=True, chopsize=1
826 _, sock, _ = self.ws.upgrade()
828 self.ws.frame_write(
829 sock, self.ws.OP_CONT, 'non-continuation payload', fin=False
831 self.ws.frame_write(sock, self.ws.OP_TEXT, 'Hello, world!', fin=True)
836 _, sock, _ = self.ws.upgrade()
838 self.ws.frame_write(
839 sock, self.ws.OP_CONT, 'non-continuation payload', fin=False
841 self.ws.frame_write(sock, self.ws.OP_TEXT, 'Hello, world!', fin=True)
846 _, sock, _ = self.ws.upgrade()
848 self.ws.frame_write(
850 self.ws.OP_CONT,
855 self.ws.frame_write(
856 sock, self.ws.OP_TEXT, 'Hello, world!', fin=True, chopsize=1
862 _, sock, _ = self.ws.upgrade()
864 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
865 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=True)
866 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment3', fin=False)
867 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment4', fin=True)
869 frame = self.ws.frame_read(sock)
871 if frame['opcode'] == self.ws.OP_TEXT:
872 self.check_frame(frame, True, self.ws.OP_TEXT, 'fragment1fragment2')
879 _, sock, _ = self.ws.upgrade()
882 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment1', fin=False)
883 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment2', fin=False)
884 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment3', fin=True)
889 _, sock, _ = self.ws.upgrade()
892 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment1', fin=True)
893 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment2', fin=False)
894 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment3', fin=True)
899 _, sock, _ = self.ws.upgrade()
901 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
902 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment2')
907 _, sock, _ = self.ws.upgrade()
909 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
910 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=False)
911 self.ws.frame_write(sock, self.ws.OP_PING, 'pongme 1!')
915 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment3', fin=False)
916 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment4', fin=False)
917 self.ws.frame_write(sock, self.ws.OP_PING, 'pongme 2!')
918 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment5')
920 frame = self.ws.frame_read(sock)
921 self.check_frame(frame, True, self.ws.OP_PONG, 'pongme 1!')
923 frame = self.ws.frame_read(sock)
924 self.check_frame(frame, True, self.ws.OP_PONG, 'pongme 2!')
927 self.ws.frame_read(sock),
929 self.ws.OP_TEXT,
935 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
936 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2', fin=False)
937 self.ws.frame_write(sock, self.ws.OP_PING, 'pongme 1!')
939 frame = self.ws.frame_read(sock)
940 self.check_frame(frame, True, self.ws.OP_PONG, 'pongme 1!')
944 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment3', fin=False)
945 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment4', fin=False)
946 self.ws.frame_write(sock, self.ws.OP_PING, 'pongme 2!')
948 frame = self.ws.frame_read(sock)
949 self.check_frame(frame, True, self.ws.OP_PONG, 'pongme 2!')
952 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment5')
955 self.ws.frame_read(sock),
957 self.ws.OP_TEXT,
968 _, sock, _ = self.ws.upgrade()
970 self.ws.frame_write(sock, self.ws.OP_TEXT, '')
971 frame = self.ws.frame_read(sock, read_timeout=3)
972 self.check_frame(frame, True, self.ws.OP_TEXT, '')
976 self.ws.frame_write(sock, self.ws.OP_TEXT, '', fin=False)
977 self.ws.frame_write(sock, self.ws.OP_CONT, '', fin=False)
978 self.ws.frame_write(sock, self.ws.OP_CONT, '')
980 frame = self.ws.frame_read(sock, read_timeout=3)
981 self.check_frame(frame, True, self.ws.OP_TEXT, '')
987 self.ws.frame_write(sock, self.ws.OP_TEXT, '', fin=False)
988 self.ws.frame_write(sock, self.ws.OP_CONT, payload, fin=False)
989 self.ws.frame_write(sock, self.ws.OP_CONT, '')
991 frame = self.ws.frame_read(sock)
992 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
998 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
1000 frame = self.ws.frame_read(sock)
1001 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
1005 self.ws.frame_write(sock, self.ws.OP_TEXT, payload[:12], fin=False)
1006 self.ws.frame_write(sock, self.ws.OP_CONT, payload[12:])
1008 frame = self.ws.frame_read(sock)
1009 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
1013 self.ws.message(sock, self.ws.OP_TEXT, payload, fragmention_size=1)
1015 frame = self.ws.frame_read(sock)
1016 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
1022 self.ws.message(sock, self.ws.OP_TEXT, payload, fragmention_size=1)
1024 frame = self.ws.frame_read(sock)
1025 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
1056 _, sock, _ = self.ws.upgrade()
1060 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
1062 frame = self.ws.frame_read(sock)
1063 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
1069 _, sock, _ = self.ws.upgrade()
1071 self.ws.frame_write(sock, self.ws.OP_CLOSE, self.ws.serialize_close())
1072 self.ws.frame_write(sock, self.ws.OP_CLOSE, self.ws.serialize_close())
1078 _, sock, _ = self.ws.upgrade()
1080 self.ws.frame_write(sock, self.ws.OP_CLOSE, self.ws.serialize_close())
1083 self.ws.frame_write(sock, self.ws.OP_PING, '')
1090 _, sock, _ = self.ws.upgrade()
1092 self.ws.frame_write(sock, self.ws.OP_CLOSE, self.ws.serialize_close())
1095 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
1102 _, sock, _ = self.ws.upgrade()
1104 self.ws.frame_write(sock, self.ws.OP_TEXT, 'fragment1', fin=False)
1105 self.ws.frame_write(sock, self.ws.OP_CLOSE, self.ws.serialize_close())
1108 self.ws.frame_write(sock, self.ws.OP_CONT, 'fragment2')
1115 _, sock, _ = self.ws.upgrade()
1117 self.ws.frame_write(sock, self.ws.OP_TEXT, 'BAsd7&jh23' * 26 * 2**10)
1118 self.ws.frame_write(sock, self.ws.OP_TEXT, payload)
1119 self.ws.frame_write(sock, self.ws.OP_CLOSE, self.ws.serialize_close())
1123 self.ws.frame_write(sock, self.ws.OP_PING, '')
1130 _, sock, _ = self.ws.upgrade()
1132 self.ws.frame_write(sock, self.ws.OP_CLOSE, '')
1137 _, sock, _ = self.ws.upgrade()
1139 self.ws.frame_write(sock, self.ws.OP_CLOSE, 'a')
1144 _, sock, _ = self.ws.upgrade()
1146 self.ws.frame_write(sock, self.ws.OP_CLOSE, self.ws.serialize_close())
1151 _, sock, _ = self.ws.upgrade()
1153 payload = self.ws.serialize_close(reason='Hello World!')
1155 self.ws.frame_write(sock, self.ws.OP_CLOSE, payload)
1160 _, sock, _ = self.ws.upgrade()
1162 payload = self.ws.serialize_close(reason='*' * 123)
1164 self.ws.frame_write(sock, self.ws.OP_CLOSE, payload)
1169 _, sock, _ = self.ws.upgrade()
1171 payload = self.ws.serialize_close(reason='*' * 124)
1173 self.ws.frame_write(sock, self.ws.OP_CLOSE, payload)
1208 _, sock, _ = self.ws.upgrade()
1210 payload = self.ws.serialize_close(code=code)
1212 self.ws.frame_write(sock, self.ws.OP_CLOSE, payload)
1216 _, sock, _ = self.ws.upgrade()
1218 payload = self.ws.serialize_close(code=code)
1220 self.ws.frame_write(sock, self.ws.OP_CLOSE, payload)
1228 _, sock, _ = self.ws.upgrade()
1230 payload = self.ws.serialize_close(code=5000)
1232 self.ws.frame_write(sock, self.ws.OP_CLOSE, payload)
1237 _, sock, _ = self.ws.upgrade()
1241 self.ws.frame_write(sock, self.ws.OP_CLOSE, payload)
1262 _, sock, _ = self.ws.upgrade()
1264 op_text = self.ws.OP_TEXT
1265 op_binary = self.ws.OP_BINARY
1268 if opcode == self.ws.OP_TEXT:
1273 self.ws.frame_write(sock, opcode, payload, chopsize=chopsize)
1274 frame = self.ws.frame_read(sock)
1278 if opcode == self.ws.OP_TEXT:
1283 self.ws.message(sock, opcode, payload, fragmention_size=f_size)
1284 frame = self.ws.frame_read(sock, read_timeout=5)
1341 _, sock, _ = self.ws.upgrade()
1345 self.ws.message(sock, self.ws.OP_TEXT, payload, fragmention_size=1300)
1347 frame = self.ws.message_read(sock)
1348 self.check_frame(frame, True, self.ws.OP_TEXT, payload)
1361 _, sock, _ = self.ws.upgrade()
1364 opcode = self.ws.OP_TEXT
1366 self.ws.frame_write(sock, opcode, payload) # frame length is 100
1368 frame = self.ws.frame_read(sock)
1373 self.ws.frame_write(sock, opcode, payload) # frame length is 101
1383 _, sock, _ = self.ws.upgrade()
1385 frame = self.ws.frame_to_send(self.ws.OP_TEXT, 'blah')
1399 _, sock, _ = self.ws.upgrade()
1401 frame = self.ws.frame_to_send(self.ws.OP_TEXT, 'blah')
1406 frame = self.ws.frame_read(sock)
1407 self.check_frame(frame, True, self.ws.OP_PING, '') # PING frame