func TestConn(t *testing.T) { signal.InstallCtrlCPanic() r1, r2 := iopipe.MakePipe() done := make(chan int) go lead(r1, 0, t, done) go lead(r2, 1, t, nil) <-done }
func TestConnOverTCP(t *testing.T) { signal.InstallCtrlCPanic() go func() { l, err := net.Listen("tcp", ":44000") if err != nil { t.Fatalf("listen: %s", err) } c, err := l.Accept() if err != nil { t.Fatalf("accept: %s", err) } go lead(c, 1, t, nil) }() c, err := net.Dial("tcp", "", ":44000") if err != nil { t.Fatalf("dial: %s", err) } done := make(chan int) go lead(c, 0, t, done) <-done }