Simulate a tcp connection in Go

后端 未结 4 1447
悲&欢浪女
悲&欢浪女 2020-12-29 15:46

In Go, a TCP connection (net.Conn) is a io.ReadWriteCloser. I\'d like to test my network code by simulating a TCP connection. There are two requirements that I have:

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 16:15

    No idea if this existed when the question was asked, but you probably want net.Pipe() which provides you with two full duplex net.Conn instances which are linked to each other

提交回复
热议问题