public void close() { if (cfg.getBus() == null) { return; } for (Closeable c : cfg.getEndpoint().getCleanupHooks()) { try { c.close(); } catch (IOException e) { // ignore } } ClientLifeCycleManager mgr = cfg.getBus().getExtension(ClientLifeCycleManager.class); if (null != mgr) { mgr.clientDestroyed(new FrontendClientAdapter(getConfiguration())); } if (cfg.getConduitSelector() instanceof Closeable) { try { ((Closeable) cfg.getConduitSelector()).close(); } catch (IOException e) { // ignore, we're destroying anyway } } else { cfg.getConduit().close(); } state.reset(); state = null; cfg = null; }