public static AsyncHttpClient asyncHttpClient() { return new DefaultAsyncHttpClient(); }
public static AsyncHttpClient asyncHttpClient(AsyncHttpClientConfig config) { return new DefaultAsyncHttpClient(config); }
public static AsyncHttpClient asyncHttpClient(DefaultAsyncHttpClientConfig.Builder configBuilder) { return new DefaultAsyncHttpClient(configBuilder.build()); }
CompletableFuture<Integer> AccessTheWebAsync() { AsyncHttpClient asyncHttpClient = new DefaultAsyncHttpClient(); return asyncHttpClient .prepareGet("http://msdn.microsoft.com") .execute() .toCompletableFuture() .thenApply(Response::getResponseBody) .thenApply(String::length); }
static AsyncHttpClient createAsyncHttpClient( String nameFormat, String timerThreadNameFormat, @Nullable SSLContext sslContext ) { final DefaultAsyncHttpClientConfig.Builder builder = new DefaultAsyncHttpClientConfig.Builder() .setThreadFactory(Execs.makeThreadFactory(nameFormat)) .setNettyTimer(new HashedWheelTimer(Execs.makeThreadFactory(timerThreadNameFormat))); if (sslContext != null) { builder.setSslContext(new JdkSslContext(sslContext, true, ClientAuth.NONE)); } return new DefaultAsyncHttpClient(builder.build()); }
DefaultAsyncHttpClient client = new DefaultAsyncHttpClient();
httpClient = new DefaultAsyncHttpClient(config);
this.asyncHttpClient = new DefaultAsyncHttpClient(new DefaultAsyncHttpClientConfig.Builder() .setUserAgent(null) .setKeepAlive(true)
this.asyncHttpClient = new DefaultAsyncHttpClient(new DefaultAsyncHttpClientConfig.Builder() .setUserAgent(null) .setKeepAlive(true)
public VkStreamingApiClient(TransportClient transportClient, Gson gson) { this.transportClient = transportClient; this.gson = gson; this.asyncHttpClient = new DefaultAsyncHttpClient(); }
private AsyncHttpClient asyncHttpClient() { synchronized (config) { if (asyncHttpClient == null) { asyncHttpClient = new DefaultAsyncHttpClient(config); } } return asyncHttpClient; }
@Bean @ConditionalOnMissingBean(AsyncHttpClient.class) public AsyncHttpClient asyncHttpClient() { return new DefaultAsyncHttpClient(); }
@Override protected AsyncHttpClient createClient(AsyncHttpClientConfig config) { AsyncHttpClient client; if (config == null) { config = new DefaultAsyncHttpClientConfig.Builder().build(); client = new DefaultAsyncHttpClient(config); } else { client = new DefaultAsyncHttpClient(config); } return client; }
public static AsyncHttpClient getAsyncHttpClient(String serviceName, int connectTimeout, int requestTimeout) { if (httpClientMap.contains(serviceName)) { return httpClientMap.get(serviceName); } else { AsyncHttpClientConfig config = AsyncHttpConfigFactory.createConfig(connectTimeout, requestTimeout); DefaultAsyncHttpClient asyncHttpClient = new DefaultAsyncHttpClient(config); httpClientMap.putIfAbsent(serviceName, asyncHttpClient); return httpClientMap.get(serviceName); } }
WebSocketTestClient(String url) { this.received = Collections.synchronizedList(new ArrayList<>()); this.fragments = Collections.synchronizedList(new ArrayList<>()); this.latch = new CountDownLatch(1); this.client = new DefaultAsyncHttpClient(); this.url = url; }
WebSocketTestClient(String url) { this.received = Collections.synchronizedList(new ArrayList<>()); this.fragments = Collections.synchronizedList(new ArrayList<>()); this.latch = new CountDownLatch(1); this.client = new DefaultAsyncHttpClient(); this.url = url; }
@Override protected void doStart() throws Exception { super.doStart(); DefaultAsyncHttpClientConfig.Builder builder = new DefaultAsyncHttpClientConfig.Builder(); builder.setAcceptAnyCertificate(true); AsyncHttpClientConfig cf = builder.build(); client = new DefaultAsyncHttpClient(cf); }
@Deprecated public static HttpClient create() { final DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder() .setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"}) .setReadTimeout(121000) .setRequestTimeout(121000) .build(); return AsyncHttpClientAdapter.of(new DefaultAsyncHttpClient(config)); }
@Deprecated public static HttpClient create() { /* http://static.javadoc.io/org.asynchttpclient/async-http-client/2.0.0-RC9/org/asynchttpclient/AsyncHttpClientConfig.html */ final DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder() .setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"}) .setReadTimeout(121000) .setRequestTimeout(121000) .build(); return AsyncHttpClientAdapter.of(new DefaultAsyncHttpClient(config)); }
@Deprecated public static HttpClient create() { /* http://static.javadoc.io/org.asynchttpclient/async-http-client/2.0.0-RC9/org/asynchttpclient/AsyncHttpClientConfig.html */ final DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder() .setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"}) .setReadTimeout(121000) .setRequestTimeout(121000) .build(); return AsyncHttpClientAdapter.of(new DefaultAsyncHttpClient(config)); }