예제 #1
0
 def receive_message(self) -> Message:
     while True:
         data = self._connection.recv_msg()
         try:
             return Message.deserialize(data)
         except JSONDecodeError:
             logger.error("failed deserializing message: {}".format(data))
예제 #2
0
    def test_when_deserializing_then_message_is_equivalent(self) -> None:
        original_data = self.message.serialize()

        deserialized_message = Message.deserialize(original_data)

        self.assertEqual(self.message, deserialized_message)