code: func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) {
  	proxyURL, err := http.ProxyFromEnvironment(req)
  	if err != nil {
  		return nil, err
  	}
  
  	if proxyURL == nil {
  		return s.dialWithoutProxy(req.URL)
  	}
  
  	// ensure we use a canonical host with proxyReq
  	targetHost := netutil.CanonicalAddr(req.URL)
  
  	// proxying logic adapted from http://blog.h6t.eu/post/74098062923/golang-websocket-with-http-proxy-support
  	proxyReq := http.Request{
  		Method: "CONNECT",
  		URL:    &url.URL{},
  		Host:   targetHost,
  	}
  
  	proxyDialConn, err := s.dialWithoutProxy(proxyURL)
  	if err != nil {
  		return nil, err
  	}
  
  	proxyClientConn := httputil.NewProxyClientConn(proxyDialConn, nil)
  	_, err = proxyClientConn.Do(&proxyReq)
  	if err != nil && err != httputil.ErrPersistEOF {
  		return nil, err
  	}
  
  	rwc, _ := proxyClientConn.Hijack()
  
  	if req.URL.Scheme != "https" {
  		return rwc, nil
  	}
  
  	host, _, err := net.SplitHostPort(req.URL.Host)
  	if err != nil {
  		return nil, err
  	}
  
  	if len(s.tlsConfig.ServerName) == 0 {
  		s.tlsConfig.ServerName = host
  	}
  
  	tlsConn := tls.Client(rwc, s.tlsConfig)
  
  	// need to manually call Handshake() so we can call VerifyHostname() below
  	if err := tlsConn.Handshake(); err != nil {
  		return nil, err
  	}
  
  	if err := tlsConn.VerifyHostname(host); err != nil {
  		return nil, err
  	}
  
  	return tlsConn, nil
  }
docs: // dial dials the host specified by req, using TLS if appropriate, optionally
  // using a proxy server if one is configured via environment variables.