})

	Describe("ContainerMetrics", func() {
		var handler *handlers.HttpHandler

		BeforeEach(func() {
			handler = handlers.NewHttpHandler(messagesToSend, loggertesthelper.Logger())
			testServer = httptest.NewServer(handler)
			trafficControllerURL = "ws://" + testServer.Listener.Addr().String()
		})

		It("returns the ContainerMetric values from ContainerEnvelopes", func() {
			env := createContainerMetric(2, 2000)
			messagesToSend <- marshalMessage(env)
			close(messagesToSend)
			envelopes, _ := cnsmr.ContainerEnvelopes(appGuid, authToken)

			messagesToSend = make(chan []byte, 100)
			handler.Messages = messagesToSend
			messagesToSend <- marshalMessage(env)
			close(messagesToSend)
			metrics, err := cnsmr.ContainerMetrics(appGuid, authToken)
			Expect(metrics).To(HaveLen(1))
			Expect(err).ToNot(HaveOccurred())
			Expect(metrics).To(ConsistOf(envelopes[0].ContainerMetric))
		})
	})

	Describe("ContainerEnvelopes", func() {
		var (
			envelopes []*events.Envelope