err = conn.Close() Expect(err).NotTo(HaveOccurred()) Expect(response).To(Equal([]byte(msg))) } It("dials the connect address when a local connection is made", func() { Expect(localForwardError).NotTo(HaveOccurred()) conn, err := net.Dial("tcp", localAddress) Expect(err).NotTo(HaveOccurred()) Eventually(echoListener.AcceptCallCount).Should(BeNumerically(">=", 1)) Eventually(fakeSecureClient.DialCallCount).Should(Equal(1)) network, addr := fakeSecureClient.DialArgsForCall(0) Expect(network).To(Equal("tcp")) Expect(addr).To(Equal(echoAddress)) Expect(conn.Close()).NotTo(HaveOccurred()) }) It("copies data between the local and remote connections", func() { validateConnectivity(localAddress) }) Context("when a local connection is already open", func() { var ( conn net.Conn err error )