def test_encode_decode_utf8(self): headers = { u'Đ¥ÑØ': u'δάüΓ', u'good\u00F1ight': u'moo\u00F1', } encoded_headers = _Headers._write_to_bytearray(headers) decoded_headers = _Headers.decode_from_frame(encoded_headers) self.assertEqual(headers, decoded_headers)
async def handle_response(self, frame): """ Complete the future associated with the data frame. Args: frame: The response frame """ if not frame: return headers = _Headers.decode_from_frame(frame) op_id = headers.get(_OPID_HEADER, None) if not op_id: raise TProtocolException(message="Frame missing op_id") async with self._futures_lock: future = self._futures.get(op_id, None) if not future: return future.set_result(frame)