private void read(SocketChannelExtender socket) {
        int result = socket.read(readBuffer);

        if ((result & RES_CLOSE_SOCKET) != 0) {
            closeSocketPair(socket);
            readBuffer.clear();
            return;
        }
        if ((result & RES_ALLOCATE_BUFFER) != 0) {
            readBuffer = new RWSocketChannelBuffer(DEFAULT_BUFFER_SIZE);
        } else {
            readBuffer.clear();
        }
        if ((result & RES_WRITE_PAIR_SOCKET) != 0) {
            SelectionKey secondKey = socket.getSecondChannel().getChannel().keyFor(selector);
            if (secondKey != null) {
                secondKey.interestOps(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
            }
        }
        if ((result & RES_WRITE_DATA_END) != 0) {
            SelectionKey secondKey = socket.getSecondChannel().getChannel().keyFor(selector);
            if (secondKey != null) {
                secondKey.interestOps(SelectionKey.OP_READ);
            }
        }
    }