public ReadableByteChannel asReadableByteChannel() {
		return new ReadableByteChannel () {
			public int read(ByteBuffer bb) throws IOException {
				//D.out ("read");
				
				if (bb.limit() > toBeRead)
					bb.limit((int) toBeRead);
				
				if (toBeRead > 0)
				{
					int haveRead = m_readableChannel.read(bb);
					
					if (haveRead == -1)
					{
						aborted = true;
						throw new IOException ("Connection was closed");
					}
					
					toBeRead = toBeRead - haveRead;

					return haveRead;
				}
				
				//throw new IOException ("Entity alread finished");
				return -1;
			}

			public void close() throws IOException {
				//D.out ("close");
			}

			public boolean isOpen() {
				boolean ret = !hasFinished () && !hasAborted () && m_connection.isConnected();
				//D.out ("isOpen " + ret);
				return ret;
			}
		};
	}