(t *testing.T)
| 70 | } |
| 71 | |
| 72 | func TestConnClosedCB(t *testing.T) { |
| 73 | s := RunDefaultServer() |
| 74 | defer s.Shutdown() |
| 75 | |
| 76 | ch := make(chan bool) |
| 77 | o := nats.GetDefaultOptions() |
| 78 | o.Url = nats.DefaultURL |
| 79 | o.ClosedCB = func(_ *nats.Conn) { |
| 80 | ch <- true |
| 81 | } |
| 82 | nc, err := o.Connect() |
| 83 | if err != nil { |
| 84 | t.Fatalf("Should have connected ok: %v", err) |
| 85 | } |
| 86 | nc.Close() |
| 87 | if e := Wait(ch); e != nil { |
| 88 | t.Fatalf("Closed callback not triggered\n") |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func TestCloseDisconnectedErrCB(t *testing.T) { |
| 93 | s := RunDefaultServer() |
nothing calls this directly
no test coverage detected