MCPcopy
hub / github.com/nats-io/nats.go / TestNoEchoOldServer

Function TestNoEchoOldServer

nats_test.go:1222–1245  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1220}
1221
1222func TestNoEchoOldServer(t *testing.T) {
1223 opts := GetDefaultOptions()
1224 opts.Url = DefaultURL
1225 opts.NoEcho = true
1226
1227 nc := &Conn{Opts: opts}
1228 if err := nc.setupServerPool(); err != nil {
1229 t.Fatalf("Problem setting up Server Pool: %v\n", err)
1230 }
1231
1232 // Old style with no proto, meaning 0. We need Proto:1 for NoEcho support.
1233 oldInfo := "{\"server_id\":\"22\",\"version\":\"1.1.0\",\"go\":\"go1.10.2\",\"port\":4222,\"max_payload\":1048576}"
1234
1235 err := nc.processInfo(oldInfo)
1236 if err != nil {
1237 t.Fatalf("Error processing old style INFO: %v\n", err)
1238 }
1239
1240 // Make sure connectProto generates an error.
1241 _, err = nc.connectProto()
1242 if err == nil {
1243 t.Fatalf("Expected an error but got none\n")
1244 }
1245}
1246
1247func TestExpiredAuthentication(t *testing.T) {
1248 // The goal of these tests was to check how a client with an expiring JWT

Callers

nothing calls this directly

Calls 5

setupServerPoolMethod · 0.95
processInfoMethod · 0.95
connectProtoMethod · 0.95
GetDefaultOptionsFunction · 0.85
FatalfMethod · 0.80

Tested by

no test coverage detected