// endpoint 2 for i := 0; i < 10; i++ { e2.Stats.NumberConnections.Increment() Expect(e2.Stats.NumberConnections.Count()).To(Equal(int64(i + 1))) } }) It("decrements number of connections", func() { e1 := route.NewEndpoint("", "1.2.3.4", 5678, "", "", nil, -1, "", modTag) e1.Stats.NumberConnections.Increment() Expect(e1.Stats.NumberConnections.Count()).To(Equal(int64(1))) e1.Stats.NumberConnections.Decrement() Expect(e1.Stats.NumberConnections.Count()).To(Equal(int64(0))) }) }) }) It("marshals json", func() { e := route.NewEndpoint("", "1.2.3.4", 5678, "", "", nil, -1, "https://my-rs.com", modTag) e2 := route.NewEndpoint("", "5.6.7.8", 5678, "", "", nil, -1, "", modTag) pool.Put(e) pool.Put(e2) json, err := pool.MarshalJSON() Expect(err).ToNot(HaveOccurred()) Expect(string(json)).To(Equal(`[{"address":"1.2.3.4:5678","ttl":-1,"route_service_url":"https://my-rs.com"},{"address":"5.6.7.8:5678","ttl":-1}]`)) }) })