private static Integer randomPort() {
		int retries = RANDOM_PORT_RETRIES;
		Random random = new Random();
		while (retries-- > 0) {
			ServerSocket socket = null;
			try {
				Integer port = random.nextInt(50000) + 10000;
				LOGGER.debug("Trying random port: " + port);
				socket = new ServerSocket(port);
				return port;
			} catch (Exception e) {
				LOGGER.warn("Port busy", e);
				try {
					Thread.sleep(random.nextInt(10) * 1000 + 1000);
				} catch (InterruptedException e1) {
					// Ignore
				}
			} finally {
				if (socket != null) {
					try {
						socket.close();
					} catch (IOException e) {
						// Ignore
					}
				}
			}
		}
		throw new IllegalStateException("Could not find a suitable random port");
	}