public static void main(String[] args) {
		String registryHostName = String.valueOf(args[0]); // Get the name of
															// the registry
		int registryPort = Integer.parseInt(args[1]); // Get the port of the
														// registry
		int specificPort = 0;
		if (args.length > 2) {
			specificPort = Integer.parseInt(args[2]);
		}

		MessagingNode messagingNode = new MessagingNode(registryHostName,
				registryPort, specificPort);

		Scanner input = new Scanner(System.in);
		String command;
		do {
			System.out.println("\nEnter a command at any time:");
			command = input.next();

			if (command.equals("print-shortest-path")) {
				messagingNode.printShortestPath();
				System.out.println();
			} else if (command.equals("exit-overlay")) {
				try {
					messagingNode.sendEvent(EventFactory.createDeregister(
							InetAddress.getLocalHost().getHostAddress(),
							messagingNode.listeningPort), messagingNode
							.getRegistrySocket());
				} catch (UnknownHostException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			} else {
				System.out.println("");
				System.out.println("Invalid command. Try one of these: ");
				System.out.println("    print-shortest-path");
				System.out.println("    exit-overlay");
			}

		} while (true);
	}