Lines Matching defs:mux
33 """Tests for mux module."""
45 from mod_pywebsocket import mux
65 """Mock class of mod_python connection for mux."""
109 parser = mux._MuxFramePayloadParser(inner_frame_data)
111 if channel_id == mux._CONTROL_CHANNEL_ID:
165 """Mock class of dispatch.Dispatcher for mux."""
221 request.mux = True
230 block = mux._create_control_block_length_value(
231 channel_id, mux._MUX_OPCODE_ADD_CHANNEL_REQUEST, encoding,
233 payload = mux._encode_channel_id(mux._CONTROL_CHANNEL_ID) + block
240 payload = mux._encode_channel_id(channel_id) + bits + message
257 """A unittest for mux module."""
261 parser = mux._MuxFramePayloadParser(data)
275 encoded = mux._encode_channel_id(0)
277 encoded = mux._encode_channel_id(2 ** 14 - 1)
279 encoded = mux._encode_channel_id(2 ** 14)
281 encoded = mux._encode_channel_id(2 ** 21 - 1)
283 encoded = mux._encode_channel_id(2 ** 21)
285 encoded = mux._encode_channel_id(2 ** 29 - 1)
289 mux._encode_channel_id,
294 block = mux._create_control_block_length_value(
295 channel_id=1, opcode=mux._MUX_OPCODE_ADD_CHANNEL_REQUEST,
301 block = mux._create_control_block_length_value(
302 channel_id=2, opcode=mux._MUX_OPCODE_ADD_CHANNEL_RESPONSE,
308 block = mux._create_control_block_length_value(
309 channel_id=3, opcode=mux._MUX_OPCODE_DROP_CHANNEL,
320 parser = mux._MuxFramePayloadParser(data)
324 self.assertEqual(mux._MUX_OPCODE_ADD_CHANNEL_REQUEST, blocks[0].opcode)
328 self.assertEqual(mux._MUX_OPCODE_DROP_CHANNEL, blocks[1].opcode)
332 self.assertEqual(mux._MUX_OPCODE_ADD_CHANNEL_REQUEST, blocks[2].opcode)
336 self.assertEqual(mux._MUX_OPCODE_DROP_CHANNEL, blocks[3].opcode)
343 data = mux._create_add_channel_response(channel_id=1,
349 data = mux._create_add_channel_response(channel_id=2,
356 data = mux._create_drop_channel(channel_id=1,
361 data = mux._create_drop_channel(channel_id=1,
368 mux._create_drop_channel,
373 command, path, version, headers = mux._parse_request_text(request_text)
392 mux_handler = mux._MuxHandler(request, dispatcher)
394 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
395 mux._INITIAL_QUOTA_FOR_CLIENT)
403 flow_control = mux._create_flow_control(channel_id=2,
414 flow_control = mux._create_flow_control(channel_id=3,
454 mux_handler = mux._MuxHandler(request, dispatcher)
456 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
457 mux._INITIAL_QUOTA_FOR_CLIENT)
476 mux_handler = mux._MuxHandler(request, dispatcher)
478 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
479 mux._INITIAL_QUOTA_FOR_CLIENT)
509 mux_handler = mux._MuxHandler(request, dispatcher)
511 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
512 mux._INITIAL_QUOTA_FOR_CLIENT)
520 drop_channel = mux._create_drop_channel(channel_id=2,
536 mux_handler = mux._MuxHandler(request, dispatcher)
538 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
539 mux._INITIAL_QUOTA_FOR_CLIENT)
547 flow_control = mux._create_flow_control(channel_id=2,
571 mux_handler = mux._MuxHandler(request, dispatcher)
573 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
574 mux._INITIAL_QUOTA_FOR_CLIENT)
582 flow_control = mux._create_flow_control(channel_id=2,
599 mux_handler = mux._MuxHandler(request, dispatcher)
601 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
602 mux._INITIAL_QUOTA_FOR_CLIENT)
611 flow_control = mux._create_flow_control(channel_id=2,
621 flow_control = mux._create_flow_control(channel_id=2,
639 mux_handler = mux._MuxHandler(request, dispatcher)
641 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
642 mux._INITIAL_QUOTA_FOR_CLIENT)
666 mux_handler = mux._MuxHandler(request, dispatcher)
668 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS, 0)
690 expected_opcode_and_flag = ((mux._MUX_OPCODE_DROP_CHANNEL << 5) |
700 mux_handler = mux._MuxHandler(request, dispatcher)
702 mux_handler.add_channel_slots(mux._INITIAL_NUMBER_OF_CHANNEL_SLOTS,
703 mux._INITIAL_QUOTA_FOR_CLIENT)
712 flow_control = mux._create_flow_control(channel_id=2,
717 flow_control = mux._create_flow_control(channel_id=2,
722 flow_control = mux._create_flow_control(channel_id=2,
739 mux_handler = mux._MuxHandler(request, dispatcher)
742 send_quota=mux._INITIAL_QUOTA_FOR_CLIENT)
749 flow_control = mux._create_flow_control(channel_id=2,
763 flow_control = mux._create_flow_control(channel_id=3,