@Override
	public byte[] getNextBlock() throws InterruptedException, NodeClosedException {
		synchronized (monitor) {
			while (!Thread.currentThread().isInterrupted()) {
				byte[] data = getNextBlockDirectly(connection.getBlockSize());

				if (data != null && data.length > 0) {
					return data;
				}

				//System.out.println("[" + Thread.currentThread().getName() + "] Waits");
				monitor.wait();
				//System.out.println("[" + Thread.currentThread().getName() + "] Continues");
			}
		}

		throw new InterruptedException();
	}