# SPDX-License-Identifier: LGPL-2.1-or-later # # Copyright (C) 2011-2023 Red Hat, Inc. # # Author: Tony Asleson import json import socket import os import unittest import threading from lsm._common import LsmError, ErrorNumber from lsm._common import SocketEOF as _SocketEOF from lsm._data import DataDecoder as _DataDecoder from lsm._data import DataEncoder as _DataEncoder class TransPort(object): """ Provides wire serialization by using json. Loosely conforms to json-rpc, however a length header was added so that we would have the ability to use non sax like json parsers, which are more abundant. = 1) for i in wire: self.c.send(bytes(i, 'utf-8')) reply, msg_id = self.client.read_resp() self.assertTrue(payload == reply) def tearDown(self): self.client.send_req("done", None) resp, msg_id = self.client.read_resp() self.assertTrue(resp is None) self.server.join() self.client.close() if __name__ == "__main__": unittest.main()