def send_request(req)
      raise StateError, "Tried to send a request while one is pending already. Make sure you read off the body." if @pending_response
      raise StateError, "Tried to send a request while a response is pending. Make sure you read off the body."  if @pending_request

      @pending_request = true

      req.stream @socket

      @pending_response = true
      @pending_request  = false
    end
def send_request(req)
      raise StateError, "Tried to send a request while one is pending already. Make sure you read off the body." if @pending_response
      raise StateError, "Tried to send a request while a response is pending. Make sure you read off the body."  if @pending_request

      @pending_request = true

      req.stream @socket

      @pending_response = true
      @pending_request  = false
    end
Send a request to the server

 @param [Request] req Request to send to the server
 @return [nil]