w.Write([]byte("Hello world!")) } func main() { s := httptest.NewServer(http.HandlerFunc(sleepHandler)) defer s.Close() resp, err := http.Get(s.URL) if err != nil { return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) /// package http var DefaultTransport RoundTripper = &Transport{ Proxy: ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, DualStack: true, }).DialContext, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, }