public static Socket create(Options options, Class<? extends Socket> socket) { AsyncHttpClient asyncHttpClient = options.runtime(); if (asyncHttpClient == null || asyncHttpClient.isClosed()) { asyncHttpClient = ClientUtil.createDefaultAsyncHttpClient(options); options.runtime(asyncHttpClient); } return getSocket(options, socket); }
public static final AsyncHttpClient createDefaultAsyncHttpClient(Options o) { AsyncHttpClientConfig.Builder b = new AsyncHttpClientConfig.Builder(); int t = o.requestTimeoutInSeconds(); b.setFollowRedirects(true) .setIdleConnectionTimeoutInMs(-1) .setRequestTimeoutInMs(t == -1 ? t : t * 1000) .setUserAgent(WASYNC_USER_AGENT); AsyncHttpClientConfig config = b.build(); return new AsyncHttpClient(config); }