# File lib/excon/connection.rb, line 20
    def initialize(url, params = {})
      uri = URI.parse(url)
      @connection = {
        :headers  => {},
        :host     => uri.host,
        :mock     => Excon.mock,
        :path     => uri.path,
        :port     => uri.port.to_s,
        :query    => uri.query,
        :scheme   => uri.scheme
      }.merge!(params)

      # use proxy from the environment if present
      if ENV.has_key?('http_proxy')
        @proxy = setup_proxy(ENV['http_proxy'])
      elsif params.has_key?(:proxy)
        @proxy = setup_proxy(params[:proxy])
      end

      if https?
        # use https_proxy if that has been specified
        if ENV.has_key?('https_proxy')
          @proxy = setup_proxy(ENV['https_proxy'])
        end
      end

      if @proxy
        @connection[:headers]['Proxy-Connection'] ||= 'Keep-Alive'
      end

      @socket_key = '' << @connection[:host] << ':' << @connection[:port]
      reset
    end