class NioNetClient extends NetClientBase {

    public NioNetClient() {
        super(false);
    }

    @Override
    protected void createConnectionInternal(Map<String, String> config, NetNode node, //
            AsyncConnectionManager connectionManager, AsyncCallback<AsyncConnection> ac,
            Scheduler scheduler) {<FILL_FUNCTION_BODY>}
}

        InetSocketAddress inetSocketAddress = node.getInetSocketAddress();
        SocketChannel channel = null;
        NetEventLoop eventLoop = (NetEventLoop) scheduler.getNetEventLoop();
        try {
            channel = SocketChannel.open();
            channel.configureBlocking(false);
            initSocket(channel.socket(), config);

            ClientAttachment attachment = new ClientAttachment();
            attachment.connectionManager = connectionManager;
            attachment.inetSocketAddress = inetSocketAddress;
            attachment.ac = ac;
            attachment.maxSharedSize = AsyncConnectionPool.getMaxSharedSize(config);

            channel.register(eventLoop.getSelector(), SelectionKey.OP_CONNECT, attachment);
            channel.connect(inetSocketAddress);
            // 如果前面已经在执行事件循环，此时就不能再次进入事件循环
            // 否则两次删除SelectionKey会出现java.util.ConcurrentModificationException
            if (!eventLoop.isInLoop()) {
                if (eventLoop.getSelector().selectNow() > 0) {
                    eventLoop.handleSelectedKeys();
                }
            }
        } catch (Exception e) {
            eventLoop.closeChannel(channel);
            ac.setAsyncResult(e);
        }
    
<methods>public void <init>(boolean) ,public void addConnection(java.net.InetSocketAddress, com.lealone.net.AsyncConnection) ,public void checkTimeout(long) ,public void close() ,public Future<com.lealone.net.AsyncConnection> createConnection(Map<java.lang.String,java.lang.String>, com.lealone.net.NetNode, com.lealone.net.AsyncConnectionManager, com.lealone.db.scheduler.Scheduler) ,public boolean isClosed() ,public boolean isThreadSafe() ,public void removeConnection(com.lealone.net.AsyncConnection) <variables>private final non-sealed Map<java.net.InetSocketAddress,com.lealone.net.AsyncConnectionPool> asyncConnections,private final java.util.concurrent.atomic.AtomicBoolean closed,private final non-sealed boolean isThreadSafe