10 func TestListener(t *testing.T) {
12 l, _ := NewDefaultListener("tcp", "localhost:8001", true)
15 lAddr := l.InternalAddress()
16 connOut, err := lAddr.Dial()
18 t.Fatalf("Could not connect to listener address %v", lAddr)
21 connIn, ok := <-l.Connections()
23 t.Fatalf("Could not get inbound connection from listener")
29 n, err := connOut.Read(b)
31 t.Fatalf("Error reading off connection: %v", err)
35 if !bytes.Equal(msg, b) {
36 t.Fatalf("Got %s, expected %s", b, msg)
39 // Close the server, no longer needed.