2
0
mirror of https://github.com/stefan01/transocks.git synced 2025-02-22 03:30:45 +07:00
transocks/http_tunnel_test.go

31 lines
556 B
Go
Raw Normal View History

2016-03-04 07:54:59 +06:00
package transocks
import (
"io"
"net"
"os"
"testing"
"time"
)
func TestHTTPDialer(t *testing.T) {
t.Skip()
// This test only works if Squid allowing CONNECT to port 80 is
// running on the local machine on port 3128.
d := &httpDialer{
addr: "127.0.0.1:3128",
forward: &net.Dialer{Timeout: 5 * time.Second},
}
conn, err := d.Dial("tcp", "www.yahoo.com:80")
if err != nil {
t.Fatal(err)
}
2016-03-09 20:23:35 +06:00
defer conn.Close()
2016-03-04 07:54:59 +06:00
conn.Write([]byte("GET / HTTP/1.1\r\nHost: www.yahoo.com:80\r\nConnection: close\r\n\r\n"))
io.Copy(os.Stdout, conn)
}