Codebase list golang-github-go-kit-kit / 076a37c
NATS update (#1095) * fix(CVE-2020-26892): 9.8 CRITICAL Updating github.com/nats-io/nats-server/v2 to version 2.2.6... Updating github.com/nats-io/nats.go to version 1.11.0... * build(deps): go mod tidy * Patch Co-authored-by: Christopher Loessl <cloessl+github@gmail.com> Peter Bourgon authored 2 years ago GitHub committed 2 years ago
4 changed file(s) with 260 addition(s) and 222 deletion(s). Raw diff Collapse all Expand all
2020 github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8 // indirect
2121 github.com/go-logfmt/logfmt v0.5.0
2222 github.com/go-stack/stack v1.8.0
23 github.com/golang/protobuf v1.3.2
23 github.com/golang/protobuf v1.4.2
2424 github.com/gorilla/mux v1.7.3
2525 github.com/hashicorp/consul/api v1.3.0
2626 github.com/hashicorp/go-version v1.2.0 // indirect
2828 github.com/hudl/fargo v1.3.0
2929 github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
3030 github.com/lightstep/lightstep-tracer-go v0.22.0
31 github.com/nats-io/nats-server/v2 v2.1.2
32 github.com/nats-io/nats.go v1.9.1
31 github.com/nats-io/nats-server/v2 v2.2.6
32 github.com/nats-io/nats.go v1.11.0
3333 github.com/oklog/oklog v0.3.2
3434 github.com/oklog/run v1.0.0 // indirect
3535 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
5252 go.opencensus.io v0.22.3
5353 go.uber.org/zap v1.13.0
5454 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
55 golang.org/x/time v0.0.0-20191024005414-555d28b269f0
55 golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1
5656 golang.org/x/tools v0.0.0-20200103221440-774c71fcf114
5757 google.golang.org/grpc v1.26.0
5858 gopkg.in/gcfg.v1 v1.2.3 // indirect
102102 github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
103103 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
104104 github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
105 github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
106105 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
106 github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
107 github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
108 github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
109 github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
110 github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
111 github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
112 github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
107113 github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
108114 github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
109115 github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
110116 github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
111117 github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
112118 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
113 github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
114119 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
120 github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
121 github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
115122 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
116123 github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
117124 github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
185192 github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
186193 github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
187194 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
195 github.com/klauspost/compress v1.11.12 h1:famVnQVu7QwryBN4jNseQdUKES71ZAOnB6UQQJPZvqk=
196 github.com/klauspost/compress v1.11.12/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
188197 github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
189198 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
190199 github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
206215 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
207216 github.com/miekg/dns v1.0.14 h1:9jZdLNd/P4+SfEJ0TNyxYpsK8N4GtfylBLqtbYN1sbA=
208217 github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
218 github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0=
219 github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
209220 github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
210221 github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
211222 github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
223234 github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
224235 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
225236 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
226 github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
227 github.com/nats-io/jwt v0.3.2 h1:+RB5hMpXUUA2dfxuhBTEkMOrYmM+gKIZYS1KjSostMI=
228 github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
229 github.com/nats-io/nats-server/v2 v2.1.2 h1:i2Ly0B+1+rzNZHHWtD4ZwKi+OU5l+uQo1iDHZ2PmiIc=
230 github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
231 github.com/nats-io/nats.go v1.9.1 h1:ik3HbLhZ0YABLto7iX80pZLPw/6dx3T+++MZJwLnMrQ=
232 github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
233 github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
234 github.com/nats-io/nkeys v0.1.3 h1:6JrEfig+HzTH85yxzhSVbjHRJv9cn0p6n3IngIcM5/k=
235 github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
237 github.com/nats-io/jwt v1.2.2 h1:w3GMTO969dFg+UOKTmmyuu7IGdusK+7Ytlt//OYH/uU=
238 github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q=
239 github.com/nats-io/jwt/v2 v2.0.2 h1:ejVCLO8gu6/4bOKIHQpmB5UhhUJfAQw55yvLWpfmKjI=
240 github.com/nats-io/jwt/v2 v2.0.2/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY=
241 github.com/nats-io/nats-server/v2 v2.2.6 h1:FPK9wWx9pagxcw14s8W9rlfzfyHm61uNLnJyybZbn48=
242 github.com/nats-io/nats-server/v2 v2.2.6/go.mod h1:sEnFaxqe09cDmfMgACxZbziXnhQFhwk+aKkZjBBRYrI=
243 github.com/nats-io/nats.go v1.11.0 h1:L263PZkrmkRJRJT2YHU8GwWWvEvmr9/LUKuJTXsF32k=
244 github.com/nats-io/nats.go v1.11.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
245 github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s=
246 github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
247 github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
236248 github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
237249 github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
238250 github.com/oklog/oklog v0.3.2 h1:wVfs8F+in6nTBMkA7CbRw+zZMIB7nNM825cM1wuzoTk=
356368 golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
357369 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
358370 golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
359 golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
360 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
361371 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
372 golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
373 golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b h1:wSOdpTq0/eI46Ez/LkDwIsAKA71YP2SRKBODiRWM0as=
374 golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
362375 golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
363376 golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
364377 golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
380393 golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
381394 golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
382395 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
383 golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA=
384396 golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
397 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
398 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
385399 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
386400 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
387401 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
397411 golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
398412 golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
399413 golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
414 golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
400415 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
401416 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
402417 golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
403418 golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
404 golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
405419 golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
406 golang.org/x/sys v0.0.0-20191220142924-d4481acd189f h1:68K/z8GLUxV76xGSqwTWw2gyk/jwn79LUL43rES2g8o=
407420 golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
421 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
422 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
423 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
408424 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
409 golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
410425 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
426 golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
427 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
411428 golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
412 golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
413 golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
429 golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI=
430 golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
414431 golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
415432 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
416433 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
425442 golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
426443 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
427444 golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
445 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
446 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
428447 google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
429448 google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
430449 google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
442461 google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
443462 google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=
444463 google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
464 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
465 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
466 google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
467 google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
468 google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
469 google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
470 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
445471 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
446472 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
447473 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
1818 }
1919 )
2020
21 nc := newNatsConn(t)
22 defer nc.Close()
23
24 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
25 if err := nc.Publish(msg.Reply, []byte(testdata)); err != nil {
26 t.Fatal(err)
27 }
28 })
29 if err != nil {
30 t.Fatal(err)
31 }
32 defer sub.Unsubscribe()
33
34 publisher := natstransport.NewPublisher(
35 nc,
21 s, c := newNATSConn(t)
22 defer func() { s.Shutdown(); s.WaitForShutdown() }()
23 defer c.Close()
24
25 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
26 if err := c.Publish(msg.Reply, []byte(testdata)); err != nil {
27 t.Fatal(err)
28 }
29 })
30 if err != nil {
31 t.Fatal(err)
32 }
33 defer sub.Unsubscribe()
34
35 publisher := natstransport.NewPublisher(
36 c,
3637 "natstransport.test",
3738 encode,
3839 decode,
6263 }
6364 )
6465
65 nc := newNatsConn(t)
66 defer nc.Close()
67
68 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
69 if err := nc.Publish(msg.Reply, msg.Data); err != nil {
70 t.Fatal(err)
71 }
72 })
73 if err != nil {
74 t.Fatal(err)
75 }
76 defer sub.Unsubscribe()
77
78 publisher := natstransport.NewPublisher(
79 nc,
66 s, c := newNATSConn(t)
67 defer func() { s.Shutdown(); s.WaitForShutdown() }()
68 defer c.Close()
69
70 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
71 if err := c.Publish(msg.Reply, msg.Data); err != nil {
72 t.Fatal(err)
73 }
74 })
75 if err != nil {
76 t.Fatal(err)
77 }
78 defer sub.Unsubscribe()
79
80 publisher := natstransport.NewPublisher(
81 c,
8082 "natstransport.test",
8183 encode,
8284 decode,
110112 }
111113 )
112114
113 nc := newNatsConn(t)
114 defer nc.Close()
115
116 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
117 if err := nc.Publish(msg.Reply, []byte(testdata)); err != nil {
118 t.Fatal(err)
119 }
120 })
121 if err != nil {
122 t.Fatal(err)
123 }
124 defer sub.Unsubscribe()
125
126 publisher := natstransport.NewPublisher(
127 nc,
115 s, c := newNATSConn(t)
116 defer func() { s.Shutdown(); s.WaitForShutdown() }()
117 defer c.Close()
118
119 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
120 if err := c.Publish(msg.Reply, []byte(testdata)); err != nil {
121 t.Fatal(err)
122 }
123 })
124 if err != nil {
125 t.Fatal(err)
126 }
127 defer sub.Unsubscribe()
128
129 publisher := natstransport.NewPublisher(
130 c,
128131 "natstransport.test",
129132 encode,
130133 decode,
157160 }
158161 )
159162
160 nc := newNatsConn(t)
161 defer nc.Close()
163 s, c := newNATSConn(t)
164 defer func() { s.Shutdown(); s.WaitForShutdown() }()
165 defer c.Close()
162166
163167 ch := make(chan struct{})
164168 defer close(ch)
165169
166 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
170 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
167171 <-ch
168172 })
169173 if err != nil {
172176 defer sub.Unsubscribe()
173177
174178 publisher := natstransport.NewPublisher(
175 nc,
179 c,
176180 "natstransport.test",
177181 encode,
178182 decode,
194198 }
195199 )
196200
197 nc := newNatsConn(t)
198 defer nc.Close()
199
200 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
201 if err := nc.Publish(msg.Reply, []byte(testdata)); err != nil {
202 t.Fatal(err)
203 }
204 })
205 if err != nil {
206 t.Fatal(err)
207 }
208 defer sub.Unsubscribe()
209
210 publisher := natstransport.NewPublisher(
211 nc,
201 s, c := newNATSConn(t)
202 defer func() { s.Shutdown(); s.WaitForShutdown() }()
203 defer c.Close()
204
205 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
206 if err := c.Publish(msg.Reply, []byte(testdata)); err != nil {
207 t.Fatal(err)
208 }
209 })
210 if err != nil {
211 t.Fatal(err)
212 }
213 defer sub.Unsubscribe()
214
215 publisher := natstransport.NewPublisher(
216 c,
212217 "natstransport.test",
213218 encode,
214219 decode,
226231 func TestEncodeJSONRequest(t *testing.T) {
227232 var data string
228233
229 nc := newNatsConn(t)
230 defer nc.Close()
231
232 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
234 s, c := newNATSConn(t)
235 defer func() { s.Shutdown(); s.WaitForShutdown() }()
236 defer c.Close()
237
238 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", func(msg *nats.Msg) {
233239 data = string(msg.Data)
234240
235 if err := nc.Publish(msg.Reply, []byte("")); err != nil {
236 t.Fatal(err)
237 }
238 })
239 if err != nil {
240 t.Fatal(err)
241 }
242 defer sub.Unsubscribe()
243
244 publisher := natstransport.NewPublisher(
245 nc,
241 if err := c.Publish(msg.Reply, []byte("")); err != nil {
242 t.Fatal(err)
243 }
244 })
245 if err != nil {
246 t.Fatal(err)
247 }
248 defer sub.Unsubscribe()
249
250 publisher := natstransport.NewPublisher(
251 c,
246252 "natstransport.test",
247253 natstransport.EncodeJSONRequest,
248254 func(context.Context, *nats.Msg) (interface{}, error) { return nil, nil },
2020 Error string `json:"err"`
2121 }
2222
23 var natsServer *server.Server
24
25 func init() {
26 natsServer = server.New(&server.Options{
23 func newNATSConn(t *testing.T) (*server.Server, *nats.Conn) {
24 s, err := server.NewServer(&server.Options{
2725 Host: "localhost",
28 Port: 4222,
26 Port: 0,
2927 })
30
31 go func() {
32 natsServer.Start()
33 }()
34
35 if ok := natsServer.ReadyForConnections(2 * time.Second); !ok {
36 panic("Failed start of NATS")
37 }
38 }
39
40 func newNatsConn(t *testing.T) *nats.Conn {
41 // Subscriptions and connections are closed asynchronously, so it's possible
42 // that there's still a subscription from an old connection that must be closed
43 // before the current test can be run.
44 for tries := 20; tries > 0; tries-- {
45 if natsServer.NumSubscriptions() == 0 {
46 break
47 }
48
49 time.Sleep(5 * time.Millisecond)
50 }
51
52 if n := natsServer.NumSubscriptions(); n > 0 {
53 t.Fatalf("found %d active subscriptions on the server", n)
54 }
55
56 nc, err := nats.Connect("nats://"+natsServer.Addr().String(), nats.Name(t.Name()))
57 if err != nil {
58 t.Fatalf("failed to connect to gnatsd server: %s", err)
59 }
60
61 return nc
28 if err != nil {
29 t.Fatal(err)
30 }
31
32 go s.Start()
33
34 for i := 0; i < 5 && !s.Running(); i++ {
35 t.Logf("Running %v", s.Running())
36 time.Sleep(time.Second)
37 }
38 if !s.Running() {
39 s.Shutdown()
40 s.WaitForShutdown()
41 t.Fatal("not yet running")
42 }
43
44 t.Log(s.Addr().String())
45
46 if ok := s.ReadyForConnections(5 * time.Second); !ok {
47 t.Fatal("not ready for connections")
48 }
49
50 //if n := s.NumSubscriptions(); n > 0 {
51 // t.Fatalf("found %d active subscriptions on the server", n)
52 //}
53
54 c, err := nats.Connect("nats://"+s.Addr().String(), nats.Name(t.Name()))
55 if err != nil {
56 t.Fatalf("failed to connect to NATS server: %s", err)
57 }
58
59 return s, c
6260 }
6361
6462 func TestSubscriberBadDecode(t *testing.T) {
65 nc := newNatsConn(t)
66 defer nc.Close()
63 s, c := newNATSConn(t)
64 defer func() { s.Shutdown(); s.WaitForShutdown() }()
65 defer c.Close()
6766
6867 handler := natstransport.NewSubscriber(
6968 func(context.Context, interface{}) (interface{}, error) { return struct{}{}, nil },
7170 func(context.Context, string, *nats.Conn, interface{}) error { return nil },
7271 )
7372
74 resp := testRequest(t, nc, handler)
73 resp := testRequest(t, c, handler)
7574
7675 if want, have := "dang", resp.Error; want != have {
7776 t.Errorf("want %s, have %s", want, have)
8079 }
8180
8281 func TestSubscriberBadEndpoint(t *testing.T) {
83 nc := newNatsConn(t)
84 defer nc.Close()
82 s, c := newNATSConn(t)
83 defer func() { s.Shutdown(); s.WaitForShutdown() }()
84 defer c.Close()
8585
8686 handler := natstransport.NewSubscriber(
8787 func(context.Context, interface{}) (interface{}, error) { return struct{}{}, errors.New("dang") },
8989 func(context.Context, string, *nats.Conn, interface{}) error { return nil },
9090 )
9191
92 resp := testRequest(t, nc, handler)
92 resp := testRequest(t, c, handler)
9393
9494 if want, have := "dang", resp.Error; want != have {
9595 t.Errorf("want %s, have %s", want, have)
9797 }
9898
9999 func TestSubscriberBadEncode(t *testing.T) {
100 nc := newNatsConn(t)
101 defer nc.Close()
100 s, c := newNATSConn(t)
101 defer func() { s.Shutdown(); s.WaitForShutdown() }()
102 defer c.Close()
102103
103104 handler := natstransport.NewSubscriber(
104105 func(context.Context, interface{}) (interface{}, error) { return struct{}{}, nil },
106107 func(context.Context, string, *nats.Conn, interface{}) error { return errors.New("dang") },
107108 )
108109
109 resp := testRequest(t, nc, handler)
110 resp := testRequest(t, c, handler)
110111
111112 if want, have := "dang", resp.Error; want != have {
112113 t.Errorf("want %s, have %s", want, have)
114115 }
115116
116117 func TestSubscriberErrorEncoder(t *testing.T) {
117 nc := newNatsConn(t)
118 defer nc.Close()
118 s, c := newNATSConn(t)
119 defer func() { s.Shutdown(); s.WaitForShutdown() }()
120 defer c.Close()
119121
120122 errTeapot := errors.New("teapot")
121123 code := func(err error) error {
137139 t.Fatal(err)
138140 }
139141
140 if err := nc.Publish(reply, b); err != nil {
142 if err := c.Publish(reply, b); err != nil {
141143 t.Fatal(err)
142144 }
143145 }),
144146 )
145147
146 resp := testRequest(t, nc, handler)
148 resp := testRequest(t, c, handler)
147149
148150 if want, have := errTeapot.Error(), resp.Error; want != have {
149151 t.Errorf("want %s, have %s", want, have)
167169 }
168170
169171 func TestMultipleSubscriberBefore(t *testing.T) {
170 nc := newNatsConn(t)
171 defer nc.Close()
172 s, c := newNATSConn(t)
173 defer func() { s.Shutdown(); s.WaitForShutdown() }()
174 defer c.Close()
172175
173176 var (
174177 response = struct{ Body string }{"go eat a fly ugly\n"}
186189 return err
187190 }
188191
189 return nc.Publish(reply, b)
192 return c.Publish(reply, b)
190193 },
191194 natstransport.SubscriberBefore(func(ctx context.Context, _ *nats.Msg) context.Context {
192195 ctx = context.WithValue(ctx, "one", 1)
203206 }),
204207 )
205208
206 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
209 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
207210 if err != nil {
208211 t.Fatal(err)
209212 }
212215 wg.Add(1)
213216 go func() {
214217 defer wg.Done()
215 _, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
218 _, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
216219 if err != nil {
217220 t.Fatal(err)
218221 }
228231 }
229232
230233 func TestMultipleSubscriberAfter(t *testing.T) {
231 nc := newNatsConn(t)
232 defer nc.Close()
234 s, c := newNATSConn(t)
235 defer func() { s.Shutdown(); s.WaitForShutdown() }()
236 defer c.Close()
233237
234238 var (
235239 response = struct{ Body string }{"go eat a fly ugly\n"}
246250 if err != nil {
247251 return err
248252 }
249
250 return nc.Publish(reply, b)
253 return c.Publish(reply, b)
251254 },
252255 natstransport.SubscriberAfter(func(ctx context.Context, nc *nats.Conn) context.Context {
253 ctx = context.WithValue(ctx, "one", 1)
254
255 return ctx
256 return context.WithValue(ctx, "one", 1)
256257 }),
257258 natstransport.SubscriberAfter(func(ctx context.Context, nc *nats.Conn) context.Context {
258259 if _, ok := ctx.Value("one").(int); !ok {
259260 t.Error("Value was not set properly when multiple ServerAfters are used")
260261 }
261
262262 close(done)
263263 return ctx
264264 }),
265265 )
266266
267 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
267 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
268268 if err != nil {
269269 t.Fatal(err)
270270 }
273273 wg.Add(1)
274274 go func() {
275275 defer wg.Done()
276 _, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
276 _, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
277277 if err != nil {
278278 t.Fatal(err)
279279 }
289289 }
290290
291291 func TestSubscriberFinalizerFunc(t *testing.T) {
292 nc := newNatsConn(t)
293 defer nc.Close()
292 s, c := newNATSConn(t)
293 defer func() { s.Shutdown(); s.WaitForShutdown() }()
294 defer c.Close()
294295
295296 var (
296297 response = struct{ Body string }{"go eat a fly ugly\n"}
308309 return err
309310 }
310311
311 return nc.Publish(reply, b)
312 return c.Publish(reply, b)
312313 },
313314 natstransport.SubscriberFinalizer(func(ctx context.Context, _ *nats.Msg) {
314315 close(done)
315316 }),
316317 )
317318
318 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
319 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
319320 if err != nil {
320321 t.Fatal(err)
321322 }
324325 wg.Add(1)
325326 go func() {
326327 defer wg.Done()
327 _, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
328 _, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
328329 if err != nil {
329330 t.Fatal(err)
330331 }
340341 }
341342
342343 func TestEncodeJSONResponse(t *testing.T) {
343 nc := newNatsConn(t)
344 defer nc.Close()
344 s, c := newNATSConn(t)
345 defer func() { s.Shutdown(); s.WaitForShutdown() }()
346 defer c.Close()
345347
346348 handler := natstransport.NewSubscriber(
347349 func(context.Context, interface{}) (interface{}, error) {
353355 natstransport.EncodeJSONResponse,
354356 )
355357
356 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
357 if err != nil {
358 t.Fatal(err)
359 }
360 defer sub.Unsubscribe()
361
362 r, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
358 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
359 if err != nil {
360 t.Fatal(err)
361 }
362 defer sub.Unsubscribe()
363
364 r, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
363365 if err != nil {
364366 t.Fatal(err)
365367 }
378380 }
379381
380382 func TestErrorEncoder(t *testing.T) {
381 nc := newNatsConn(t)
382 defer nc.Close()
383 s, c := newNATSConn(t)
384 defer func() { s.Shutdown(); s.WaitForShutdown() }()
385 defer c.Close()
383386
384387 errResp := struct {
385388 Error string `json:"err"`
392395 natstransport.EncodeJSONResponse,
393396 )
394397
395 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
396 if err != nil {
397 t.Fatal(err)
398 }
399 defer sub.Unsubscribe()
400
401 r, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
398 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
399 if err != nil {
400 t.Fatal(err)
401 }
402 defer sub.Unsubscribe()
403
404 r, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
402405 if err != nil {
403406 t.Fatal(err)
404407 }
415418 type noContentResponse struct{}
416419
417420 func TestEncodeNoContent(t *testing.T) {
418 nc := newNatsConn(t)
419 defer nc.Close()
421 s, c := newNATSConn(t)
422 defer func() { s.Shutdown(); s.WaitForShutdown() }()
423 defer c.Close()
420424
421425 handler := natstransport.NewSubscriber(
422426 func(context.Context, interface{}) (interface{}, error) { return noContentResponse{}, nil },
424428 natstransport.EncodeJSONResponse,
425429 )
426430
427 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
428 if err != nil {
429 t.Fatal(err)
430 }
431 defer sub.Unsubscribe()
432
433 r, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
431 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
432 if err != nil {
433 t.Fatal(err)
434 }
435 defer sub.Unsubscribe()
436
437 r, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
434438 if err != nil {
435439 t.Fatal(err)
436440 }
441445 }
442446
443447 func TestNoOpRequestDecoder(t *testing.T) {
444 nc := newNatsConn(t)
445 defer nc.Close()
448 s, c := newNATSConn(t)
449 defer func() { s.Shutdown(); s.WaitForShutdown() }()
450 defer c.Close()
446451
447452 handler := natstransport.NewSubscriber(
448453 func(ctx context.Context, request interface{}) (interface{}, error) {
455460 natstransport.EncodeJSONResponse,
456461 )
457462
458 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
459 if err != nil {
460 t.Fatal(err)
461 }
462 defer sub.Unsubscribe()
463
464 r, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
463 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
464 if err != nil {
465 t.Fatal(err)
466 }
467 defer sub.Unsubscribe()
468
469 r, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
465470 if err != nil {
466471 t.Fatal(err)
467472 }
489494 )
490495
491496 go func() {
492 nc := newNatsConn(t)
493 defer nc.Close()
494
495 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
497 s, c := newNATSConn(t)
498 defer func() { s.Shutdown(); s.WaitForShutdown() }()
499 defer c.Close()
500
501 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
496502 if err != nil {
497503 t.Fatal(err)
498504 }
499505 defer sub.Unsubscribe()
500506
501 r, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
507 r, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
502508 if err != nil {
503509 t.Fatal(err)
504510 }
509515 return func() { stepch <- true }, response
510516 }
511517
512 func testRequest(t *testing.T, nc *nats.Conn, handler *natstransport.Subscriber) TestResponse {
513 sub, err := nc.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(nc))
514 if err != nil {
515 t.Fatal(err)
516 }
517 defer sub.Unsubscribe()
518
519 r, err := nc.Request("natstransport.test", []byte("test data"), 2*time.Second)
518 func testRequest(t *testing.T, c *nats.Conn, handler *natstransport.Subscriber) TestResponse {
519 sub, err := c.QueueSubscribe("natstransport.test", "natstransport", handler.ServeMsg(c))
520 if err != nil {
521 t.Fatal(err)
522 }
523 defer sub.Unsubscribe()
524
525 r, err := c.Request("natstransport.test", []byte("test data"), 2*time.Second)
520526 if err != nil {
521527 t.Fatal(err)
522528 }