* @param b
     * @param bytes
     * @param mgr 
     * @throws IOException
     */
    private static void processBytes(Object id, SelectionKey key, DataChunkImpl chunk, int bytes, SelectorManager2 mgr) throws IOException
    {
        WrapperAndListener struct = (WrapperAndListener)key.attachment();
        DataListener in = struct.getDataHandler();
        BasChannelImpl channel = (BasChannelImpl)struct.getChannel();
        
        ByteBuffer b = chunk.getData();
        //in 1.5.0_08, was getting a nullpointer on helper...
        b.flip(); //helper.doneFillingBuffer(b);
        
		if(bytes < 0) {
			if(apiLog.isLoggable(Level.FINE))
				apiLog.fine(channel+"far end closed, cancel key, close socket");
			channel.closeOnSelectorThread();
			in.farEndClosed(channel);
		} else if(bytes > 0) {
			//let's DEregister for read until this packet is processed and re-register when they set the chunk to processed(true)
			unregisterChannelForReads(mgr, channel);
			
			if(apiLog.isLoggable(Level.FINER))
				apiLog.finer(channel+"READ bytes="+bytes);
			in.incomingData(channel, chunk);
		}
    }