var fakeClient *fakes.FakeClient BeforeEach(func() { fakeClient = newFakeClient("udp", "host:port") clientFactory = func(_ *steno.Logger, _ string) (loggregatorclient.Client, error) { return fakeClient, nil } }) It("the client is stopped", func() { s := map[string]string{ "a": "udp://host:port", } pool.Set(s, nil) Expect(fakeClient.StopCallCount()).To(Equal(0)) pool.Set(nil, nil) Expect(fakeClient.StopCallCount()).To(Equal(1)) }) }) Context("with identical server data", func() { var clientFactoryCallCount int BeforeEach(func() { clientFactoryCallCount = 0 clientFactory = func(logger *steno.Logger, url string) (loggregatorclient.Client, error) { clientFactoryCallCount++ return fakeClientFactory(logger, url) } })