1
// Copyright 2012 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
9
// direct-tcpip functional tests
17
func TestTCPIPHTTP(t *testing.T) {
18
// google.com will generate at least one redirect, possibly three
19
// depending on your location.
20
doTest(t, "http://google.com")
23
func TestTCPIPHTTPS(t *testing.T) {
24
doTest(t, "https://encrypted.google.com/")
27
func doTest(t *testing.T, url string) {
28
server := newServer(t)
29
defer server.Shutdown()
30
conn := server.Dial(clientConfig())
33
tr := &http.Transport{
34
Dial: func(n, addr string) (net.Conn, error) {
35
return conn.Dial(n, addr)
38
client := &http.Client{
41
resp, err := client.Get(url)
43
t.Fatalf("unable to proxy: %s", err)
45
// got a body without error