Execute an async request using specified client.

@param client client used to make request
@return future that resolves to requested object
556462
public ListenableFuture<T> createAsync(final TwilioRestClient client) {
        return Twilio.getExecutorService().submit(new Callable<T>() {
            public T call() {
                return create(client);
            }
        });
    }
522007
public Client<? extends Options, ? extends OptionsBuilder, ? extends RequestBuilder> newClient() {
        if (clientClassName == null) {
            return new DefaultClient();
        } else {
            try {
                return (Client) Thread.currentThread().getContextClassLoader().loadClass(clientClassName).newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
27941
public static <T> Future<T> submit(Callable<T> task) {
		return executor.submit(task);
	}
709538
protected <R> R executeRequest(Request request, JavaType javaType)
    {
        long start = System.currentTimeMillis();
        boolean error = true;
        try
        {
            Response response = executeRequest(request);
            R r = readResponse(response, javaType);
            error = false;
            return r;
        }
        finally
        {
            if(clientEventListener != null)
            {
                ClientEvent event = new ClientEvent(baseUrl,request.getEntityName(),request.getRequestMethod(),
                        System.currentTimeMillis() - start,error);
                clientEventListener.handleEvent(event);
            }
        }
    }
1261366
private FutureRequestExecutionService buildRequestExecutorService(final CloseableHttpClient httpClient) {
        if (this.executorService == null) {
            this.executorService = new ThreadPoolExecutor(this.threadsNumber, this.threadsNumber, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(this.queueSize));
        }
        return new FutureRequestExecutionService(httpClient, this.executorService);
    }
885241
@Override
    public ResourceSet<Execution> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
1302101
public ListenableFuture<T> open(NiftyClientConnector<? extends NiftyClientChannel> connector)
    {
        return clientManager.createClient(
                connector,
                clientType,
                connectTimeout,
                receiveTimeout,
                readTimeout,
                writeTimeout,
                maxFrameSize,
                clientName,
                eventHandlers,
                getSocksProxyOrDefault());
    }
285408
public static void createAsync(final GWTVizPlotClient client) {
        GWT.runAsync(new RunAsyncCallback() {
            public void onFailure(Throwable err) {
                client.onUnavailable();
            }

            public void onSuccess() {
                if (instance == null) {
                    instance = new GWTVizPlot();
                }
                client.onSuccess(instance);
            }
        });
    }
10652
public Client build(final Client client) {
    client.register(TracingClientFilter.create(tracing));
    return client;
  }
560399
function AsyncClient(client) {
  this.client = client;
  this.query = this.query.bind(this);
  this.end = this.end.bind(this);
}
973854
protected void handleClient(final Socket client) throws IOException {
		final ClientHandler handler = new ClientHandler(client);
		this.executorService.execute(handler);
	}
364902
public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncClientStreamingCall(
      ClientStreamingMethod<ReqT, RespT> method) {
    return asyncStreamingRequestCall(method);
  }
353373
@Override
    public RetryingHttpClient build(Client<HttpRequest, HttpResponse> delegate) {
        if (needsContentInStrategy) {
            return new RetryingHttpClient(delegate, retryStrategyWithContent(), maxTotalAttempts(),
                                          responseTimeoutMillisForEachAttempt(), useRetryAfter,
                                          contentPreviewLength);
        }

        return new RetryingHttpClient(delegate, retryStrategy(), maxTotalAttempts(),
                                      responseTimeoutMillisForEachAttempt(), useRetryAfter);
    }
269556
private HttpResponse execute(HttpClient client, HttpUriRequest request) throws IOException {
        if (localContext != null) {
            return client.execute(request, localContext);
        } else {
            return client.execute(request);
        }
    }
1151102
public static HttpResponse execute(HttpRequestBase request) throws IOException {

		Assert.notNull(request, "Missing request!");
		HttpClient client = HttpClientBuilder.create().setRedirectStrategy(new DefaultRedirectStrategy()).build();
		return client.execute(request);
	}
977533
private <T> CompletionStage<T> executeRequest(HttpAsyncClient httpClient,
            HttpUriRequest httpRequest, JsonParser<T> parser) {
        CompletableFuture<T> future = new CompletableFuture<>();
        httpClient.execute(httpRequest, new FutureCallback<HttpResponse>() {
            @Override
            public void failed(Exception e) {
                future.completeExceptionally(e);
            }

            @Override
            public void completed(HttpResponse response) {
                int statusCode = response.getStatusLine().getStatusCode();
                if (statusCode == HttpStatus.SC_OK ||
                        statusCode == HttpStatus.SC_ACCEPTED) {

                    // Parse result type from the returned JSON
                    try {
                        T result = parser.parse(response.getEntity().getContent());
                        future.complete(result);
                    } catch (Exception e) {
                        future.completeExceptionally(e);
                    }
                } else {
                    future.completeExceptionally(createSaltException(statusCode));
                }
            }

            @Override
            public void cancelled() {
                future.cancel(false);
            }
        });

        return future;
    }
275018
@Override
    public Future<?> submit(Runnable task) {
        if (task == null) {
            throw new NullPointerException();
        }
        RunnableFuture<Object> ftask = newTaskFor(task, null);
        execute(ftask);
        return ftask;
    }