Python netcatl';我们的电话卡住了

Python netcatl';我们的电话卡住了,python,linux,multithreading,netcat,Python,Linux,Multithreading,Netcat,我试图使用netcat为我的tcp端口转发器编写测试,但测试卡在join上。我正在尝试发送和接收样本数据,然后进行比较 def test_forwarding(self): route = self.config.routes[0] proc = subprocess.Popen(["nc -l %s" % route.sink[1]], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) th = t

我试图使用
netcat
为我的tcp端口转发器编写测试,但测试卡在
join
上。我正在尝试发送和接收样本数据,然后进行比较

def test_forwarding(self):
    route = self.config.routes[0]

    proc = subprocess.Popen(["nc -l %s" % route.sink[1]], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
    th = threading.Thread(target=lambda: system('nc %s %s < test_data.txt' % route.source))
    th.start()
    th.join()

    self.assertEqual(open('test_data.txt').readline(), proc.stdout.read())
def测试_转发(自):
route=self.config.routes[0]
proc=subprocess.Popen([“nc-l%s”%route.sink[1]],stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
th=threading.Thread(目标=lambda:system('nc%s%s