} testServer = httptest.NewServer(fakeHandler) trafficControllerUrl = "ws://" + testServer.Listener.Addr().String() appGuid = "app-guid" } Describe("Debug Printing", func() { var debugPrinter *fakeDebugPrinter BeforeEach(func() { startFakeTrafficController() debugPrinter = &fakeDebugPrinter{} connection = noaa.NewConsumer(trafficControllerUrl, tlsSettings, consumerProxyFunc) connection.SetDebugPrinter(debugPrinter) }) It("includes websocket handshake", func() { fakeHandler.Close() logChan := make(chan *events.LogMessage, 100) connection.TailingLogsWithoutReconnect(appGuid, authToken, logChan) Eventually(func() int { return len(debugPrinter.Messages) }).Should(BeNumerically(">=", 1)) Expect(debugPrinter.Messages[0].Body).To(ContainSubstring("Sec-WebSocket-Version: 13")) }) It("does not include messages sent or received", func() { fakeHandler.InputChan <- marshalMessage(createMessage("hello", 0))
} testServer = httptest.NewServer(fakeHandler) trafficControllerUrl = "ws://" + testServer.Listener.Addr().String() appGuid = "app-guid" } Describe("Debug Printing", func() { var debugPrinter *fakeDebugPrinter BeforeEach(func() { startFakeTrafficController() debugPrinter = &fakeDebugPrinter{} cnsmr = noaa.NewConsumer(trafficControllerUrl, tlsSettings, consumerProxyFunc) cnsmr.SetDebugPrinter(debugPrinter) }) It("includes websocket handshake", func() { fakeHandler.Close() logChan := make(chan *events.LogMessage, 100) cnsmr.TailingLogsWithoutReconnect(appGuid, authToken, logChan) Eventually(func() int { return len(debugPrinter.Messages) }).Should(BeNumerically(">=", 1)) Expect(debugPrinter.Messages[0].Body).To(ContainSubstring("Sec-WebSocket-Version: 13")) }) It("does not include messages sent or received", func() { fakeHandler.InputChan <- marshalMessage(createMessage("hello", 0))