class Test(unittest.TestCase): def __init__(self, config): unittest.TestCase.__init__(self) self.config = config self.communication = None def setUp(self): self.communication = Communication(self.config.target_ip, self.config.target_port, self.config.protocol_version, log=log) def tearDown(self): self.communication.close()
import sys, os from queue import Queue sys.path.append(os.path.abspath('.')) from communication import Communication from_sock_buff = Queue() from_comp_buff = Queue() port = 12345 frame_size = 32 com = Communication(from_sock_buff, from_comp_buff, port, frame_size) com.listen() for i in range(100): from_comp_buff.put('hello from server: {}'.format(i).encode()) print(from_sock_buff.get()) com.close()