Example #1
0
			errorChan = make(chan error, 10)
			logMessageChan = make(chan *events.LogMessage)
			go func() {
				errorChan <- connection.TailingLogsWithoutReconnect(appGuid, authToken, logMessageChan)
				close(finishedChan)
			}()
		}

		BeforeEach(func() {
			finishedChan = make(chan struct{})
			startFakeTrafficController()
		})

		AfterEach(func() {
			connection.Close()
			<-finishedChan
		})

		Context("when there is no TLS Config or consumerProxyFunc setting", func() {
			Context("when the connection can be established", func() {
				It("receives messages on the incoming channel", func(done Done) {
					fakeHandler.InputChan <- marshalMessage(createMessage("hello", 0))

					perform()
					message := <-logMessageChan

					Expect(message.GetMessage()).To(Equal([]byte("hello")))
					fakeHandler.Close()

					close(done)
Example #2
0
			errorChan = make(chan error, 10)
			logMessageChan = make(chan *events.LogMessage)
			go func() {
				errorChan <- cnsmr.TailingLogsWithoutReconnect(appGuid, authToken, logMessageChan)
				close(finishedChan)
			}()
		}

		BeforeEach(func() {
			finishedChan = make(chan struct{})
			startFakeTrafficController()
		})

		AfterEach(func() {
			cnsmr.Close()
			<-finishedChan
		})

		Context("when there is no TLS Config or consumerProxyFunc setting", func() {
			Context("when the connection can be established", func() {
				It("receives messages on the incoming channel", func(done Done) {
					fakeHandler.InputChan <- marshalMessage(createMessage("hello", 0))

					perform()
					message := <-logMessageChan

					Expect(message.GetMessage()).To(Equal([]byte("hello")))
					fakeHandler.Close()

					close(done)