def request(req)
      json_str = JSON::generate(req, { :ascii_only=>true })
      http    = Net::HTTP.new(@uri.host, @uri.port)
      request = Net::HTTP::Post.new(@uri.request_uri)
      request.body = json_str
      request["Content-Type"] = "application/json"
      response = http.request(request)
      if response.code != "200"
        raise RpcException.new(-32000, "Non-200 response #{response.code} from #{@url}")
      else
        return JSON::parse(response.body)
      end
    end
def request(req)
      json_str = JSON::generate(req, { :ascii_only=>true })
      http    = Net::HTTP.new(@uri.host, @uri.port)
      request = Net::HTTP::Post.new(@uri.request_uri)
      request.body = json_str
      request["Content-Type"] = "application/json"
      response = http.request(request)
      if response.code != "200"
        raise RpcException.new(-32000, "Non-200 response #{response.code} from #{@url}")
      else
        return JSON::parse(response.body)
      end
    end
Takes the URL to the server endpoint and parses it
 `request` is the only required method on a transport class.

 `req` is a JSON-RPC request with `id`, `method`, and optionally `params` slots.

 The transport is very simple, and does the following:

 * Serialize `req` to JSON. Make sure to use `:ascii_only=true`
 * POST the JSON string to the endpoint, setting the MIME type correctly
 * Deserialize the JSON response string
 * Return the deserialized hash