Describe("FirehoseWithoutReconnect", func() {
		var (
			incomings    <-chan *events.Envelope
			streamErrors <-chan error
			idleTimeout  time.Duration
		)

		BeforeEach(func() {
			incomings = make(chan *events.Envelope)
			startFakeTrafficController()
		})

		JustBeforeEach(func() {
			cnsmr.SetIdleTimeout(idleTimeout)
			incomings, streamErrors = cnsmr.FirehoseWithoutReconnect("subscription-id", authToken)
		})

		Context("when there is no TLS Config or consumerProxyFunc setting", func() {
			Context("when the connection can be established", func() {
				It("receives messages from the full firehose", func() {
					fakeHandler.Close()

					Eventually(fakeHandler.GetLastURL).Should(ContainSubstring("/firehose/subscription-id"))
				})

				Context("with a message", func() {
					BeforeEach(func() {
						fakeHandler.InputChan <- marshalMessage(createMessage("hello", 0))
					})
		Describe("Stream", func() {
			It("loads a token if the provided token is empty", func() {
				cnsmr.Stream("some-fake-app-guid", "")
				Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
			})

			It("loads a token if the provided token fails with 401", func() {
				testHandler.responseStatuses <- http.StatusUnauthorized
				cnsmr.Stream("some-fake-app-guid", "")
				Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
			})
		})

		Describe("FirehoseWithoutReconnect", func() {
			It("loads a token if the provided token is empty", func() {
				cnsmr.FirehoseWithoutReconnect("some-fake-app-guid", "")
				Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
			})

			It("loads a token if the provided token fails with 401", func() {
				testHandler.responseStatuses <- http.StatusUnauthorized
				cnsmr.FirehoseWithoutReconnect("some-fake-app-guid", "")
				Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
			})
		})

		Describe("Firehose", func() {
			It("loads a token if the provided token is empty", func() {
				cnsmr.Firehose("some-fake-app-guid", "")
				Eventually(refresher.RefreshAuthTokenCalled).Should(BeCalled())
			})