if (entry == null) {
return DefaultConnectFuture.newFailedFuture(new IOException(
"Endpoint unavailable: " + address));
}
DefaultConnectFuture future = new DefaultConnectFuture();
VmPipeSessionImpl localSession = new VmPipeSessionImpl(this, config,
getListeners(), new Object(), // lock
new AnonymousSocketAddress(), handler, entry);
// initialize connector session
try {
IoFilterChain filterChain = localSession.getFilterChain();
this.getFilterChainBuilder().buildFilterChain(filterChain);
config.getFilterChainBuilder().buildFilterChain(filterChain);
config.getThreadModel().buildFilterChain(filterChain);
// The following sentences don't throw any exceptions.
localSession.setAttribute(AbstractIoFilterChain.CONNECT_FUTURE,
future);
getListeners().fireSessionCreated(localSession);
VmPipeIdleStatusChecker.getInstance().addSession(localSession);
} catch (Throwable t) {
future.setException(t);
return future;
}
// initialize acceptor session
VmPipeSessionImpl remoteSession = localSession.getRemoteSession();