コード例 #1
0
ファイル: AsynchronousSocket.java プロジェクト: 1730wang/deft
 /**
  * Create a new {@code AsynchronousSocket} that will delegate its io operations the given {@code
  * SelectableChannel}.
  */
 public AsynchronousSocket(SelectableChannel channel) {
   this.channel = channel;
   interestOps = SelectionKey.OP_CONNECT;
   if (channel instanceof SocketChannel && (((SocketChannel) channel).isConnected())) {
     interestOps |= SelectionKey.OP_READ;
   }
   IOLoop.INSTANCE.addHandler(channel, this, interestOps, null);
 }