9 "github.com/tendermint/tmlibs/log"
12 func TestListener(t *testing.T) {
14 l := NewDefaultListener("tcp", ":8001", true, log.TestingLogger())
17 lAddr := l.ExternalAddress()
18 connOut, err := lAddr.Dial()
20 t.Fatalf("Could not connect to listener address %v", lAddr)
22 t.Logf("Created a connection to listener address %v", lAddr)
24 connIn, ok := <-l.Connections()
26 t.Fatalf("Could not get inbound connection from listener")
32 n, err := connOut.Read(b)
34 t.Fatalf("Error reading off connection: %v", err)
38 if !bytes.Equal(msg, b) {
39 t.Fatalf("Got %s, expected %s", b, msg)
42 // Close the server, no longer needed.