Ejemplo n.º 1
0
 def test_from_stream(self):
     data = b"\xb0\x02\x00\x0a"
     stream = asyncio.StreamReader(loop=self.loop)
     stream.feed_data(data)
     stream.feed_eof()
     message = self.loop.run_until_complete(UnsubackPacket.from_stream(stream))
     self.assertEqual(message.variable_header.packet_id, 10)
Ejemplo n.º 2
0
 async def mqtt_acknowledge_unsubscription(self, packet_id):
     unsuback = UnsubackPacket.build(packet_id)
     await self._send_packet(unsuback)
Ejemplo n.º 3
0
 def mqtt_acknowledge_unsubscription(self, packet_id):
     unsuback = UnsubackPacket.build(packet_id)
     yield from self._send_packet(unsuback)
Ejemplo n.º 4
0
 def mqtt_acknowledge_unsubscription(self, packet_id):
     unsuback = UnsubackPacket.build(packet_id)
     yield from self._send_packet(unsuback)
Ejemplo n.º 5
0
 def test_to_stream(self):
     variable_header = PacketIdVariableHeader(10)
     publish = UnsubackPacket(variable_header=variable_header)
     out = publish.to_bytes()
     self.assertEqual(out, b"\xb0\x02\x00\x0a")
Ejemplo n.º 6
0
 def mqtt_acknowledge_unsubscription(self, packet_id):
     unsuback = UnsubackPacket.build(packet_id)
     yield from self.outgoing_queue.put(unsuback)
Ejemplo n.º 7
0
 def test_from_stream(self):
     data = b'\xb0\x02\x00\x0a'
     stream = BufferReader(data)
     message = self.loop.run_until_complete(UnsubackPacket.from_stream(stream))
     self.assertEqual(message.variable_header.packet_id, 10)
Ejemplo n.º 8
0
 def test_to_stream(self):
     variable_header = PacketIdVariableHeader(10)
     publish = UnsubackPacket(variable_header=variable_header)
     out = publish.to_bytes()
     self.assertEqual(out, b'\xb0\x02\x00\x0a')
Ejemplo n.º 9
0
 def test_from_stream(self):
     data = b'\xb0\x02\x00\x0a'
     stream = BufferReader(data)
     message = self.loop.run_until_complete(
         UnsubackPacket.from_stream(stream))
     self.assertEqual(message.variable_header.packet_id, 10)