ghttp.CombineHandlers( ghttp.VerifyRequest("GET", "/"), ghttp.RespondWith(http.StatusOK, "hi from jim\n"), ), ) }) It("forwards the local port to the target from the server side", func() { lconn, err := client.Dial("tcp", server.Addr()) Expect(err).NotTo(HaveOccurred()) transport := &http.Transport{ Dial: func(network, addr string) (net.Conn, error) { return lconn, nil }, } client := &http.Client{Transport: transport} resp, err := client.Get("http://127.0.0.1/") Expect(err).NotTo(HaveOccurred()) Expect(resp.StatusCode).To(Equal(http.StatusOK)) reader := bufio.NewReader(resp.Body) line, err := reader.ReadString('\n') Expect(err).NotTo(HaveOccurred()) Expect(line).To(ContainSubstring("hi from jim")) }) }) }) })