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); }
@Override public void cleanup() { if (!asyncHttpClient.isClosed()) { asyncHttpClient.close(); } }