(t *testing.T)
| 393 | } |
| 394 | |
| 395 | func TestEncBuiltinRequestReceivesMsg(t *testing.T) { |
| 396 | s := RunServerOnPort(TEST_PORT) |
| 397 | defer s.Shutdown() |
| 398 | |
| 399 | ec := NewDefaultEConn(t) |
| 400 | defer ec.Close() |
| 401 | |
| 402 | expectedResp := "I can help!" |
| 403 | |
| 404 | ec.Subscribe("help", func(subj, reply, req string) { |
| 405 | ec.Publish(reply, expectedResp) |
| 406 | }) |
| 407 | |
| 408 | var resp nats.Msg |
| 409 | |
| 410 | err := ec.Request("help", "help me", &resp, 1*time.Second) |
| 411 | if err != nil { |
| 412 | t.Fatalf("Failed at receiving proper response: %v\n", err) |
| 413 | } |
| 414 | if string(resp.Data) != expectedResp { |
| 415 | t.Fatalf("Received reply '%s', wanted '%s'\n", string(resp.Data), expectedResp) |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | func TestEncBuiltinAsyncMarshalErr(t *testing.T) { |
| 420 | s := RunServerOnPort(TEST_PORT) |
nothing calls this directly
no test coverage detected