protected InternelListener makeConnectedInternelListener(
			final ConnectedListener listener) {
		return new InternelListener() {
			@Override
			public void notifyListener(final SelectionKey key) {
				// temporary ignore the selection
				key.interestOps(key.interestOps() ^ SelectionKey.OP_CONNECT
						| SelectionKey.OP_READ);

				try {
					// finished connect
					((SocketChannel) key.channel()).finishConnect();
				} catch (Exception e) {
					NIO.LOGGER.error("fail to finished connect,cancel key:"
							+ key, e);
					NIO.this.cancelAndNotify(key, listener);
					return;
				}

				// connecte ok,async forward
				NIO.this.asyncs.offer(new Runnable() {
					@Override
					public void run() {
						// switch to readable listener
						key.attach(NIO.this
								.makeReadableInternelListener(listener));

						// notify
						try {
							listener.notifyConnected((SocketChannel) key
									.channel());
						} catch (Exception e) {
							NIO.LOGGER.error(
									"fail to notify connected for key:" + key
											+ " close it", e);
							NIO.this.cancelAndNotify(key, listener);
						}
					}
				});
			}
		};
	}