public void close() {
		stop = true;

		if (!socket.isClosed())
			try {
				// Interrupt the incoming thread immediately
				in.interrupt();

				// But join the outgoing thread to let it finish serving the queue.
				out.join();

				// Finally, close the socket
				socket.close();
			} catch (final InterruptedException ie) {
				// Ignore
			} catch (final IOException ioe) {
				// Ignore
			}

		logger.info("Peer exchange with " + peer + " closed.");
	}