module WebMock::NetHTTPUtility

def self.get_uri(net_http, path = nil)

def self.get_uri(net_http, path = nil)
  protocol = net_http.use_ssl? ? "https" : "http"
  hostname = net_http.address
  hostname = "[#{hostname}]" if /\A\[.*\]\z/ !~ hostname && /:/ =~ hostname
  "#{protocol}://#{hostname}:#{net_http.port}#{path}"
end