def poll(connection, request_options, stop_at)
      url = connection[:host] + connection[:path] + request_options.delete(:query).to_s
      begin
        result, code, body, headers = request_once(:get, url, request_options)
      end until result || Time.now >= stop_at
      connection[:expires_at] = Time.now + BalancedHttpClient::CONNECTION_REUSE_TIMEOUT
      [result, code, body, headers]
    end
def poll(connection, request_options, stop_at)
      url = connection[:host] + connection[:path] + request_options.delete(:query).to_s
      begin
        result, code, body, headers = request_once(:get, url, request_options)
      end until result || Time.now >= stop_at
      connection[:expires_at] = Time.now + BalancedHttpClient::CONNECTION_REUSE_TIMEOUT
      [result, code, body, headers]
    end
Make long-polling requests until receive data, hit error, or timeout

 @param [Hash] connection to server from previous request with keys :host, :path,
   and :expires_at, with the :expires_at being adjusted on return
 @param [Hash] request_options for HTTP request
 @param [Time] stop_at time for polling

 @return [Array] result to be returned followed by response code, body, and headers

 @raise [HttpException] HTTP failure with associated status code