Helper method to walk the iterator and create a new request that defines which control param
should be negotiated right now.
359132
private void negotiate(final ChannelHandlerContext ctx) {
    if (controlSettings.hasNext()) {
      Map.Entry<String, String> setting = controlSettings.next();

      LOGGER.debug("Negotiating DCP Control {}: {}", setting.getKey(), setting.getValue());
      ByteBuf request = ctx.alloc().buffer();
      DcpControlRequest.init(request);
      DcpControlRequest.key(setting.getKey(), request);
      DcpControlRequest.value(Unpooled.copiedBuffer(setting.getValue(), CharsetUtil.UTF_8), request);

      ctx.writeAndFlush(request);
    } else {
      originalPromise().setSuccess();
      ctx.pipeline().remove(this);
      ctx.fireChannelActive();
      LOGGER.debug("Negotiated all DCP Control settings against Node {}", ctx.channel().remoteAddress());
    }
  }
1186906
def build_request(method, query_params={})
      query   = { token: token }.merge(query_params)
      request = { query: query, method: method, headers: {}, mock: @test_mode }

      if Diffbot.instrumentor
        request.update(
          instrumentor: Diffbot.instrumentor,
          instrumentor_name: "diffbot"
        )
      end

      request
    end
1132431
public final ControlRequest createNewControlRequest() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createNewControlRequest");
    ControlRequest msg = null;
    try {
      msg = new ControlRequestImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createNewControlRequest");
    return msg;
  }
1125938
public void createControlAdapter()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createControlAdapter");

    // The type of control adapter created depends on the type of destination
    // that we're working with
    if(!destinationHandler.isLink())
    {
      XmitPoint rqm =
        (XmitPoint) destinationHandler.getRemoteQueuePointControl(getLocalizingMEUuid(), true);
      controlAdapter = new XmitPointControl(rqm,
                                            this,                                        
                                            destinationHandler); 
    }
    else
    { 
      // Use the StreamSet's Control Adapter for the "link remote queue points"
      controlAdapter = 
        new LinkRemoteQueuePoint(destinationHandler, this);
    }                                          
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createControlAdapter", controlAdapter);
  }
860714
def _get_handler_set(cls, request, fail_enum, header_proto=None):
        
        added = set()
        handlers = []

        for controls in request.sorting:
            control_bytes = controls.SerializeToString()
            if control_bytes not in added:
                added.add(control_bytes)
                handlers.append(
                    cls._ValueHandler(controls, fail_enum, header_proto))

        return handlers
131775
def begin_call(self, method, *args):
        
        d = Deferred(self.loop)
        d.request = self.request_num
        self.requests[self.request_num] = d
        self.protocol.send_request(d.request, method, args)
        self.request_num += 1
        return d
290265
private RequestTemplate appendQuery(String name,
                                      Iterable<String> values,
                                      CollectionFormat collectionFormat) {
    if (!values.iterator().hasNext()) {
      /* empty value, clear the existing values */
      this.queries.remove(name);
      return this;
    }

    /* create a new query template out of the information here */
    this.queries.compute(name, (key, queryTemplate) -> {
      if (queryTemplate == null) {
        return QueryTemplate.create(name, values, this.charset, collectionFormat);
      } else {
        return QueryTemplate.append(queryTemplate, values, collectionFormat);
      }
    });
    return this;
  }
1198280
function requestHandler(req, res, next) {
  const start = Date.now();
  let source;

  return Promise.try(() => {
    source = core.getPublicSource(req.params.src);
    return source.getHandler().getInfoAsync().then(info => [info, infoHeaders]);
  }).spread((data, dataHeaders) => {
    core.setResponseHeaders(res, source, dataHeaders);

    if (req.query && req.query.format) {
      const escapedText = JSON.stringify(data, null, ' ').replace(/&/g, '&amp;').replace(/</g, '&lt;');
      res.send(`<pre>${escapedText}</pre>`);
    } else {
      res.json(data);
    }

    const mx = util.format('req.%s.info', req.params.src);
    core.metrics.endTiming(mx, start);
  }).catch(err => core.reportRequestError(err, res)).catch(next);
}
1325049
private void initTypeParameterBindings()
    {
        //
        // Get an iterator to both the declared type arguments and the original type
        // declaration on the associated control interface
        //
        DeclaredType fieldType = (DeclaredType)_fieldDecl.getType();
        Iterator<TypeMirror> paramBoundIter = fieldType.getActualTypeArguments().iterator();

        TypeDeclaration intfDecl = (TypeDeclaration)_controlIntf.getTypeDeclaration();
        Iterator<TypeParameterDeclaration> paramDeclIter = 
                                            intfDecl.getFormalTypeParameters().iterator();

        //
        // Iterate through them in parallel, creating a mapping from the original formal
        // type parameter name to the actual bound type.  In parallel, also build up a
        // representation of the bound type declaration.
        //
        // NOTE: If no type binding is done on the field declaration, then loop below
        // will not execute and no mappings/empty bound decl will be the result.
        //
        StringBuffer sb = new StringBuffer();
        boolean isFirst = true;
        while (paramBoundIter.hasNext())
        {
            TypeMirror paramBound = paramBoundIter.next();
            TypeParameterDeclaration paramDecl = paramDeclIter.next();

            //
            // Save a mapping from the formal type name to the bound mirror type
            //
            _typeBindingMap.put(paramDecl.getSimpleName(), paramBound);

            if (isFirst)
            {
                sb.append("<");
                isFirst = false;
            }
            else
                sb.append(", ");
            sb.append(paramBound);
        }
        if (!isFirst)
            sb.append(">");
        
        _boundParameterDecl = sb.toString();
    }
1359172
function (methodName, params, execOptions) {
                var requestId = this._getRequestId(methodName, params);
                var promise = this._getRequestPromise(requestId);

                if (!promise) {
                    this._addToBatch(methodName, params);
                    promise = this._createPromise(requestId);
                    this._run(execOptions);
                }

                return promise;
            }
132625
def negotiate_safe(self, name, params):
        
        for param in params.iterkeys():
            if param not in self.defaults:
                return

        try:
            return dict(self.negotiate(name, params))
        except (KeyError, ValueError, AssertionError):
            pass
388502
def process_response_params(
        self,
        params: Sequence[ExtensionParameter],
        accepted_extensions: Sequence["Extension"],
    ) -> PerMessageDeflate:
        
        if any(other.name == self.name for other in accepted_extensions):
            raise NegotiationError(f"Received duplicate {self.name}")

        # Request parameters are available in instance variables.

        # Load response parameters in local variables.
        (
            server_no_context_takeover,
            client_no_context_takeover,
            server_max_window_bits,
            client_max_window_bits,
        ) = _extract_parameters(params, is_server=False)

        # After comparing the request and the response, the final
        # configuration must be available in the local variables.

        # server_no_context_takeover
        #
        #   Req.    Resp.   Result
        #   ------  ------  --------------------------------------------------
        #   False   False   False
        #   False   True    True
        #   True    False   Error!
        #   True    True    True

        if self.server_no_context_takeover:
            if not server_no_context_takeover:
                raise NegotiationError("Expected server_no_context_takeover")

        # client_no_context_takeover
        #
        #   Req.    Resp.   Result
        #   ------  ------  --------------------------------------------------
        #   False   False   False
        #   False   True    True
        #   True    False   True - must change value
        #   True    True    True

        if self.client_no_context_takeover:
            if not client_no_context_takeover:
                client_no_context_takeover = True

        # server_max_window_bits

        #   Req.    Resp.   Result
        #   ------  ------  --------------------------------------------------
        #   None    None    None
        #   None    8≤M≤15  M
        #   8≤N≤15  None    Error!
        #   8≤N≤15  8≤M≤N   M
        #   8≤N≤15  N<M≤15  Error!

        if self.server_max_window_bits is None:
            pass

        else:
            if server_max_window_bits is None:
                raise NegotiationError("Expected server_max_window_bits")
            elif server_max_window_bits > self.server_max_window_bits:
                raise NegotiationError("Unsupported server_max_window_bits")

        # client_max_window_bits

        #   Req.    Resp.   Result
        #   ------  ------  --------------------------------------------------
        #   None    None    None
        #   None    8≤M≤15  Error!
        #   True    None    None
        #   True    8≤M≤15  M
        #   8≤N≤15  None    N - must change value
        #   8≤N≤15  8≤M≤N   M
        #   8≤N≤15  N<M≤15  Error!

        if self.client_max_window_bits is None:
            if client_max_window_bits is not None:
                raise NegotiationError("Unexpected client_max_window_bits")

        elif self.client_max_window_bits is True:
            pass

        else:
            if client_max_window_bits is None:
                client_max_window_bits = self.client_max_window_bits
            elif client_max_window_bits > self.client_max_window_bits:
                raise NegotiationError("Unsupported client_max_window_bits")

        return PerMessageDeflate(
            server_no_context_takeover,  # remote_no_context_takeover
            client_no_context_takeover,  # local_no_context_takeover
            server_max_window_bits or 15,  # remote_max_window_bits
            client_max_window_bits or 15,  # local_max_window_bits
            self.compress_settings,
        )
705464
@SuppressWarnings("unchecked")
  public Request addParameter(String name, Object value) {
    Map<String, Object> map = Objects.requireNonNull(parameterMap);
    if (!map.containsKey(name)) {
      map.put(name, value);
    } else {
      Object value0 = map.get(name);
      if (value0 instanceof Collection) {
        if (value instanceof Collection) {
          ((Collection) value0).addAll((Collection) value);
        } else {
          ((Collection) value0).add(value);
        }
      } else {
        List<Object> paramArray = new LinkedList<>();
        if (value instanceof Collection) {
          paramArray.addAll((Collection) value);
        } else {
          paramArray.add(value);
        }
        map.put(name, paramArray);
      }
    }
    return this;
  }
749724
def _perform_content_negotiation
      if fmt = params[:format] and !fmt.blank?
        accepts = [fmt.to_sym]
      else
        accepts = _accept_types
      end

      provided_formats = _provided_formats
      
      specifics = accepts & provided_formats
      return specifics.first unless specifics.length == 0
      return provided_formats.first if accepts.include?(:all) && !provided_formats.empty?
      
      message  = "A format (%s) that isn't provided (%s) has been requested. "
      message += "Make sure the action provides the format, and be "
      message += "careful of before filters which won't recognize "
      message += "formats provided within actions."
      raise Merb::ControllerExceptions::NotAcceptable,
        (message % [accepts.join(', '), provided_formats.join(', ')])
    end
1003604
def get_request_handler(self):
        
        assert self.request_handler is not None, \
            'Please define a request_handler ' \
            ' for Endpoint: %s' % self.__class__.__name__

        return self.request_handler(self, **self.get_request_handler_params())
1292979
def gen_request_parameters method, params
      #add common parameters
      params.merge! self.service.default_parameters

      params.merge! self.options

      params[:Action] = method.to_s
      params[:Timestamp] = Time.now.utc.iso8601
      params[:SignatureNonce] = SecureRandom.uuid
      params[:Signature] = compute_signature params

      params
    end
911436
def request(method, action, params={}, options={})
      # Augment in interesting options
      options[:call_chain] = _path_array
      options[:action] = action
      @requester.send(method, _path(action), params, options)
    end