即像这样:
import io
file_1 = io.BytesIO() # Or whatever object needs to be created...
file_2 = io.BytesIO() # Or whatever object needs to be created...
file_1.connect(file_2) # ?
file_1.write("asd") # A thread reading from file_2 will receive this data
我目前正在为内部设计的协议实现这两个端点,这将帮助我测试它而无需建立任何套接字连接。