@Override
	public void run() {
		ClientHandler c;
		stop = false;

		if (!isConnected())
			throw new IllegalStateException("Service not connected!");

		pool = Executors.newCachedThreadPool(new ClientThreadFactory(
				getUncaughtExceptionHandler()));

		try {
			try {
				while (!stop) {
					c = new ClientHandler(ns.accept(), as, this.keyDirectory, this.privateKeyServer);
					clientHandlerList.add(c);
					pool.execute(c);
				}
			} finally {
				if (pool != null)
					shutdownAndAwaitTermination(pool);
				if (ns != null)
					ns.close();
			}
		} catch (IOException e) {
			// The if-clause down here is because of what is described in
			// http://docs.oracle.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html
			// under "What if a thread doesn't respond to Thread.interrupt?"

			// So the socket is closed when the ClientNetworkService is
			// closed and in that special case no error should be
			// propagated.
			if (!stop) {
				UncaughtExceptionHandler eh = this
						.getUncaughtExceptionHandler();
				if (eh != null)
					eh.uncaughtException(this, e);
			}
		}
	}