def rpc(rpc_method, input, req_opts=nil)
      rpcdef = self.class.rpcs[rpc_method.to_s]
      if !rpcdef
        return ClientResp.new(nil, Twirp::Error.bad_route("rpc not defined on this client"))
      end

      content_type = (req_opts && req_opts[:headers] && req_opts[:headers]['Content-Type']) || @content_type

      input = rpcdef[:input_class].new(input) if input.is_a? Hash
      body = Encoding.encode(input, rpcdef[:input_class], content_type)

      resp = self.class.make_http_request(@conn, @service_full_name, rpc_method, content_type, req_opts, body)
      if resp.status != 200
        return ClientResp.new(nil, self.class.error_from_response(resp))
      end

      if resp.headers['Content-Type'] != content_type
        return ClientResp.new(nil, Twirp::Error.internal("Expected response Content-Type #{content_type.inspect} but found #{resp.headers['Content-Type'].inspect}"))
      end

      data = Encoding.decode(resp.body, rpcdef[:output_class], content_type)
      return ClientResp.new(data, nil)
    end
def rpc(rpc_method, input, req_opts=nil)
      rpcdef = self.class.rpcs[rpc_method.to_s]
      if !rpcdef
        return ClientResp.new(nil, Twirp::Error.bad_route("rpc not defined on this client"))
      end

      content_type = (req_opts && req_opts[:headers] && req_opts[:headers]['Content-Type']) || @content_type

      input = rpcdef[:input_class].new(input) if input.is_a? Hash
      body = Encoding.encode(input, rpcdef[:input_class], content_type)

      resp = self.class.make_http_request(@conn, @service_full_name, rpc_method, content_type, req_opts, body)
      if resp.status != 200
        return ClientResp.new(nil, self.class.error_from_response(resp))
      end

      if resp.headers['Content-Type'] != content_type
        return ClientResp.new(nil, Twirp::Error.internal("Expected response Content-Type #{content_type.inspect} but found #{resp.headers['Content-Type'].inspect}"))
      end

      data = Encoding.decode(resp.body, rpcdef[:output_class], content_type)
      return ClientResp.new(data, nil)
    end
class << self
 Init with a Faraday connection, or a base_url that is used in a default connection.
 Clients use Content-Type="application/protobuf" by default. For JSON clinets use :content_type => "application/json".
 Make a remote procedure call to a defined rpc_method. The input can be a Proto message instance,
 or the attributes (Hash) to instantiate it. Returns a ClientResp instance with an instance of
 output_class, or a Twirp::Error. The input and output classes are the ones configued with the rpc DSL.
 If rpc_method was not defined with the rpc DSL then a response with a bad_route error is returned instead.