def _read_frame(self): """Try and read from the frame buffer and decode a frame. :rtype tuple: (int, pika.frame.Frame) """ return frame.decode_frame(self._frame_buffer)
def _run0(self): (_frame_type, _channel, _payload, read_frame_buffer) = self._connection.read_frame() _consumed_count, frame_value = frame.decode_frame(read_frame_buffer) if isinstance(frame_value, frame.Heartbeat): LOGGER.debug("receive heartbeat") elif isinstance(frame_value, frame.Method) and (isinstance(frame_value.method, spec.Basic.Ack) or isinstance(frame_value.method, spec.Basic.Ack)): # for In publisher-acknowledgments mode self._connection.deliver_pub_ack(frame_value) else: self._connection.deliver_frame(frame_value)
def decode_body_frame_fragment_consumed_bytes_test(self): self.assertEqual(frame.decode_frame(self.BODY_FRAME)[0], 28)
def decode_frame_decoding_failure_test(self): self.assertEqual( frame.decode_frame(b'\x01\x00\x01\x00\x00\xce'), (0, None))
def decode_body_frame_instance_test(self): self.assertIsInstance( frame.decode_frame(self.BODY_FRAME)[1], frame.Body)
def decode_method_frame_method_test(self): self.assertIsInstance( frame.decode_frame(self.BASIC_ACK)[1].method, spec.Basic.Ack)
def decode_header_frame_bytes_test(self): self.assertEqual(frame.decode_frame(self.CONTENT_HEADER)[0], 23)
def decode_protocol_header_bytes_test(self): self.assertEqual(frame.decode_frame(self.PROTOCOL_HEADER)[0], 8)
def decode_protocol_header_failure_test(self): self.assertEqual(frame.decode_frame(b'AMQPa'), (0, None))
def decode_header_frame_instance_test(self): self.assertIsInstance( frame.decode_frame(self.CONTENT_HEADER)[1], frame.Header)
def decode_method_frame_bytes_test(self): self.assertEqual(frame.decode_frame(self.BASIC_ACK)[0], 21)
def decode_method_frame_instance_test(self): self.assertIsInstance( frame.decode_frame(self.BASIC_ACK)[1], frame.Method)
def decode_protocol_header_instance_test(self): self.assertIsInstance( frame.decode_frame(self.PROTOCOL_HEADER)[1], frame.ProtocolHeader)
def decode_heartbeat_frame_bytes_consumed_test(self): self.assertEqual(frame.decode_frame(self.HEARTBEAT)[0], 8)
def decode_header_frame_properties_test(self): frame_value = frame.decode_frame(self.CONTENT_HEADER)[1] self.assertIsInstance(frame_value.properties, spec.BasicProperties)
def decode_frame_decoding_failure_test(self): self.assertEqual(frame.decode_frame(b'\x01\x00\x01\x00\x00\xce'), (0, None))
def decode_frame_decoding_no_end_byte_test(self): self.assertEqual(frame.decode_frame(self.BASIC_ACK[:-1]), (0, None))
def decode_heartbeat_frame_test(self): self.assertIsInstance( frame.decode_frame(self.HEARTBEAT)[1], frame.Heartbeat)
def decode_body_frame_fragment_test(self): self.assertEqual( frame.decode_frame(self.BODY_FRAME)[1].fragment, self.BODY_FRAME_VALUE)