private static void parseCommandLine(String[] args) throws IOException,
			NumberFormatException {
		for (String arg : args) {
			String[] vals = arg.split("=", 2);
			String key = vals[0].trim();
			String value = vals[1].trim();
			if (key.equals("--mode") || key.equals("-mode")) {
				try {
					MODE = Mode.valueOf(value.toUpperCase());
				} catch (IllegalArgumentException e) {
					// Ignored, error msg will be printed below.
				}
			} else if (key.equals("--port") || key.equals("-port")) {
				PORT = Integer.parseInt(value);
			} else if (key.equals("--options") || key.equals("-options")) {
				Options.initialize(value);
			}
		}
	}