module Protobuf::Rpc::Connectors::Common

def _send_request

Sends the request to the server, invoked by the connection_completed event
def _send_request
  request_wrapper = Protobuf::Socketrpc::Request.new
  request_wrapper.service_name = @options[:service].name
  request_wrapper.method_name = @options[:method].to_s
  if @options[:request].class == @options[:request_type]
    request_wrapper.request_proto = @options[:request].serialize_to_string
  else
    expected = @options[:request_type].name
    actual = @options[:request].class.name
    fail :INVALID_REQUEST_PROTO, 'Expected request type to be type of %s, got %s instead' % [expected, actual]
  end
  log_debug "[#{log_signature}] Sending Request: %s" % request_wrapper.inspect
  request_buffer = Protobuf::Rpc::Buffer.new(:write, request_wrapper)
  @stats.request_size = request_buffer.size
  send_data(request_buffer.write)
end