public byte[] readBytes(int numBytes) throws BeanstalkDisconnectedException, BeanstalkException{
		
		byte[] bytes = new byte[numBytes];

		byte[] array = this.outbuf.toByteArray();
		this.outbuf = new ByteArrayOutputStream();
		
		int bytesWritten = 0;
		//first read any bytes that are already in the outbuffer.
		for (int i=0; i < array.length; i++) {
			if (bytesWritten < bytes.length) {
				bytes[i] = array[i];
				bytesWritten++;
			} else {
				this.outbuf.write(array[i]);
			}
			
		}
//		log.info("GOT 468: " + bytesWritten + " " + bytes.length);
		if (bytesWritten >= bytes.length) {
			return bytes;
		}
		
		int numRead = 1;
		while(numRead >0) {
			//then read the bytes waiting in the channel.
			ByteBuffer buf = ByteBuffer.allocate(4096);
			try {
				numRead = channel.read(buf);
			} catch (Exception x) {
				this.throwException(x);
			}
			
			byte[] read = buf.array();
			for (int i=0 ; i<numRead; i++) {
				if (bytesWritten < bytes.length) {
					bytes[bytesWritten] = read[i];
				} else {
					this.outbuf.write(read[i]);
				}
				bytesWritten++;
			}
			if (bytesWritten >= bytes.length) {
				log.debug("468 GOT : " + bytesWritten + " " + bytes.length);
				return bytes;
			}
		}
//		log.info("GOT : " + bytesWritten + " " + bytes.length);
		return bytes;
	}