}) Describe("Stream", func() { var envelopeChan chan *events.Envelope var errorChan chan error var doneChan chan struct{} var stopChan chan struct{} perform := func() { connection = noaa.NewConsumer(trafficControllerUrl, tlsSettings, consumerProxyFunc) envelopeChan = make(chan *events.Envelope) errorChan = make(chan error, 10) stopChan = make(chan struct{}) doneChan = make(chan struct{}) go func() { connection.Stream(appGuid, authToken, envelopeChan, errorChan, stopChan) close(doneChan) }() } BeforeEach(func() { startFakeTrafficController() }) It("attempts to connect five times", func() { fakeHandler.fail = true perform() fakeHandler.Close() Eventually(errorChan, 3).Should(HaveLen(5))
}) }) }) Describe("Stream", func() { var envelopeChan chan *events.Envelope var errorChan chan error var doneChan chan struct{} perform := func() { cnsmr = noaa.NewConsumer(trafficControllerUrl, tlsSettings, consumerProxyFunc) envelopeChan = make(chan *events.Envelope) errorChan = make(chan error, 10) doneChan = make(chan struct{}) go func() { cnsmr.Stream(appGuid, authToken, envelopeChan, errorChan) close(doneChan) }() } BeforeEach(func() { startFakeTrafficController() }) It("attempts to connect five times", func() { fakeHandler.fail = true perform() fakeHandler.Close() Eventually(errorChan, 3).Should(HaveLen(5))