Send a request and get a future.

@param etcdRequest Etcd Request to send
@return Promise for the request.
15436
public <R> EtcdResponsePromise<R> send(final EtcdRequest<R> etcdRequest) throws IOException {
    ConnectionState connectionState = new ConnectionState(uris, lastWorkingUriIndex);

    if (etcdRequest.getPromise() == null) {
      etcdRequest.setPromise(new EtcdResponsePromise<R>(
        etcdRequest.getRetryPolicy(),
        connectionState,
        new RetryHandler() {
          @Override
          public void doRetry(ConnectionState connectionState) throws IOException {
            connect(etcdRequest, connectionState);
          }
      }));
    }

    connect(etcdRequest, connectionState);

    return etcdRequest.getPromise();
  }
143004
public static <T> Future<T> execute(Callable<T> callable) throws RejectedExecutionException {
        return getValidExecutor().submit(wrapCallable(callable, MsgIdHolder.get()));
    }
1270503
private <M extends MessageHeaders<EmptyRequestBody, P, U>, U extends MessageParameters, P extends ResponseBody> CompletableFuture<P>
			sendRequest(M messageHeaders, U messageParameters) {
		return sendRequest(messageHeaders, messageParameters, EmptyRequestBody.getInstance());
	}
1194798
public CompletableFuture<OpenSessionResponse> openSession(OpenSessionRequest request) {
    CompletableFuture<OpenSessionResponse> future = new CompletableFuture<>();
    if (context.isCurrentContext()) {
      sendRequest(request, protocol::openSession, future);
    } else {
      context.execute(() -> sendRequest(request, protocol::openSession, future));
    }
    return future;
  }
822953
public Promise<HttpResponse> send(HttpRequest request) {
		SettablePromise<HttpResponse> promise = new SettablePromise<>();
		this.promise = promise;
		assert pool == null;
		(pool = client.poolReadWrite).addLastNode(this);
		poolTimestamp = eventloop.currentTimeMillis();
		HttpHeaderValue connectionHeader = CONNECTION_KEEP_ALIVE_HEADER;
		if (client.maxKeepAliveRequests != -1) {
			if (++numberOfKeepAliveRequests >= client.maxKeepAliveRequests) {
				connectionHeader = CONNECTION_CLOSE_HEADER;
			}
		}
		request.addHeader(CONNECTION, connectionHeader);
		ByteBuf buf = renderHttpMessage(request);
		if (buf != null) {
			writeBuf(buf);
		} else {
			writeHttpMessageAsChunkedStream(request);
		}
		request.recycle();
		if (!isClosed()) {
			try {
				readHttpMessage();
			} catch (ParseException e) {
				closeWithError(e);
			}
		}
		return promise;
	}
915127
public static <T> T get(Future<T> future) throws ExecutionException {
        try {
            return future.get();
        } catch (InterruptedException e) {
            logger.log(Level.SEVERE, "Re-throwing InterruptedException as ExecutionException");
            throw new ExecutionException(e);
        }
    }
954988
public Future<T> doConfigurationUpdate(final ConfigurationRequest<T> configurationRequest) {
        Util.notNull(configurationRequest, "ConfigurationRequest passed to ConfigurationHandler");
        return executorService.submit(new Callable<T>() {
            public T call() throws Exception {
                try {
                    T conf = configurationRequest.invoke();
                    updateListenersWithNewConfiguration(conf);
                    return conf;
                } catch (Exception e) {
                    updateListenersWithFailure(e);
                    throw e;
                }
            }
        });
    }
93875
public CompletableFuture<CloseSessionResponse> closeSession(CloseSessionRequest request) {
    CompletableFuture<CloseSessionResponse> future = new CompletableFuture<>();
    if (context.isCurrentContext()) {
      sendRequest(request, protocol::closeSession, future);
    } else {
      context.execute(() -> sendRequest(request, protocol::closeSession, future));
    }
    return future;
  }
100565
public Future<Notice> send(Notice notice) {
    notice = this.filterNotice(notice);
    CompletableFuture<Notice> future = this.asyncSender.send(notice);

    final Notice finalNotice = notice;
    future.whenComplete(
        (value, exception) -> {
          this.applyHooks(finalNotice);
        });

    return future;
  }
1039006
public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) {
        if (checkOpen(true)) {
            return write(msg, promise);
        }
        return checkException(promise);
    }
441382
protected <T extends Request, U extends Response> CompletableFuture<U> forward(T request) {
    CompletableFuture<U> future = new CompletableFuture<>();
    context.getConnections().getConnection(context.getLeader().serverAddress()).whenComplete((connection, connectError) -> {
      if (connectError == null) {
        connection.<T, U>sendAndReceive(request).whenComplete((response, responseError) -> {
          if (responseError == null) {
            future.complete(response);
          } else {
            future.completeExceptionally(responseError);
          }
        });
      } else {
        future.completeExceptionally(connectError);
      }
    });
    return future;
  }
267086
protected void beforeSend(RpcInternalContext context, SofaRequest request) {
        currentRequests.incrementAndGet();
        context.setLocalAddress(localAddress());
    }
925198
function wrap(superagent, Promise) {
  /**
   * Request object similar to superagent.Request, but with end() returning
   * a promise.
   */
  function PromiseRequest() {
    superagent.Request.apply(this, arguments);
  }

  // Inherit form superagent.Request
  PromiseRequest.prototype = Object.create(superagent.Request.prototype);

  /** Send request and get a promise that `end` was emitted */
  PromiseRequest.prototype.end = function(cb) {
    var _end = superagent.Request.prototype.end;
    var self = this;

    return new Promise(function(accept, reject) {
      _end.call(self, function(err, response) {
        if (cb) {
          cb(err, response);
        }

        if (err) {
          err.response = response;
          reject(err);
        } else {
          accept(response);
        }
      });
    });
  };

  /** Provide a more promise-y interface */
  PromiseRequest.prototype.then = function(resolve, reject) {
    var _end = superagent.Request.prototype.end;
    var self = this;

    return new Promise(function(accept, reject) {
      _end.call(self, function(err, response) {
        if (err) {
          err.response = response;
          reject(err);
        } else {
          accept(response);
        }
      });
    }).then(resolve, reject);
  };

  /**
   * Request builder with same interface as superagent.
   * It is convenient to import this as `request` in place of superagent.
   */
  var request = function(method, url) {
    return new PromiseRequest(method, url);
  };

  /** Helper for making an options request */
  request.options = function(url) {
    return request('OPTIONS', url);
  }

  /** Helper for making a head request */
  request.head = function(url, data) {
    var req = request('HEAD', url);
    if (data) {
      req.send(data);
    }
    return req;
  };

  /** Helper for making a get request */
  request.get = function(url, data) {
    var req = request('GET', url);
    if (data) {
      req.query(data);
    }
    return req;
  };

  /** Helper for making a post request */
  request.post = function(url, data) {
    var req = request('POST', url);
    if (data) {
      req.send(data);
    }
    return req;
  };

  /** Helper for making a put request */
  request.put = function(url, data) {
    var req = request('PUT', url);
    if (data) {
      req.send(data);
    }
    return req;
  };

  /** Helper for making a patch request */
  request.patch = function(url, data) {
    var req = request('PATCH', url);
    if (data) {
      req.send(data);
    }
    return req;
  };

  /** Helper for making a delete request */
  request.del = function(url, data) {
    var req = request('DELETE', url);
    if (data) {
      req.send(data);
    }
    return req;
  };

  // Export the request builder
  return request;
}
919643
async def send(self, request: ClientRequest, **kwargs: Any) -> AsyncClientResponse:  # type: ignore
        
        # It's not recommended to provide its own session, and is mostly
        # to enable some legacy code to plug correctly
        session = kwargs.pop('session', self.session)

        loop = kwargs.get("loop", asyncio.get_event_loop())
        future = loop.run_in_executor(
            None,
            functools.partial(
                session.request,
                request.method,
                request.url,
                **kwargs
            )
        )
        try:
            return AsyncRequestsClientResponse(
                request,
                await future
            )
        except requests.RequestException as err:
            msg = "Error occurred in request."
            raise_with_traceback(ClientRequestError, msg, err)
151631
public static HttpServletRequest getOuterRequest( HttpServletRequest request )
    {
        ScopedRequest scopedRequest = unwrapRequest( request );
        return scopedRequest != null ? scopedRequest.getOuterRequest() : request;
    }
703139
public EtcdResponse get(String key) throws EtcdException {
		UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
		builder.pathSegment(key);

		return execute(builder, HttpMethod.GET, null, EtcdResponse.class);
	}
1174505
function () {
      const encodeABI = contract.deploy(options).encodeABI();
      txParams.data = encodeABI;

      return new Promise(function (onResolve, onReject) {
        web3Provider.eth.sendTransaction(txParams)
          .on('transactionHash', function(transactionHash){
            onResolve(transactionHash)
          })
          .on('error', onReject);
      });
    }