我正在try 对我的网络应用程序运行一些测试.我想避免 for each 测试创建一个插槽,所以我想使用标准库中的io.Pipe个.但它只提供io.PipeReader、io.PipeWriter对.我需要两个相连的io.ReadWriteClosers
func TestEndpoints() {
// Create pipeEndpoint1 and pipeEndpoint2. Both should implement
// io.ReadWriteCloser
e1 := makeEndpoint(pipeEndpoint1)
e2 := makeEndpoint(pipeEndpoint2)
// Run some test
}
func makeEndpoint(rwc io.ReadWriteCloser) *Endpoint {
//
}
有没有方法创建两个相连的io.ReadWriteClosers?