private Socket connect () {
	Socket socket = null;
	int attempts = 0;
	do {
	    attempts ++;
	    try {
		socket = new Socket(Utils.REGISTRAR_ADDR, Utils.REGISTRAR_PORT);
		socket.setKeepAlive(true);
		socket.setSoTimeout(0);
	    } catch (Exception e) {
		String msg =
		    String.format("Warning: connection attempt %d failed at %s.",
				  attempts, this.getInfo());
		System.err.println(msg);
		System.err.println(e.getMessage());
		try {
		    Thread.sleep(random.nextInt(100) + 1); /* [0..100] + 1 > 0. */
		} catch (InterruptedException ignored) {}
	    }
	} while (socket == null);
	return socket;
    }