public static void main(String[] args) throws Exception {
		long time = System.currentTimeMillis();

		// Loading configuration first

		try (FileInputStream fis = new FileInputStream(CONFIG_PATH)) {
			logger.info("Loading configuration");
			System.getProperties().load(fis);
		} catch (Throwable t) {
			logger.error("Unable to load configurations", t);
			System.exit(-1);
		}

		try {
			String protocol = System.getProperty("http-protocol", DEFAULT_PROTOCOL);
			String scheme = System.getProperty("org.apache.coyote.http11.SCHEME", DEFAULT_SCHEME);
			// Creating the web connector service
			// use the static NodeService if configured.
			WebConnectorService service = new WebConnectorService(protocol, scheme,
					new CLNodeService());
			// configure the web connector service

			// Setting the address (host:port)
			int port = DEFAULT_HTTP_PORT;
			String portStr = System.getProperty("org.apache.tomcat.util.net.PORT");

			if (portStr != null) {
				try {
					port = Integer.valueOf(portStr);
				} catch (Throwable t) {
					logger.error(t.getMessage(), t);
					System.setProperty("org.apache.tomcat.util.net.PORT", "" + DEFAULT_HTTP_PORT);
				}
			} else {
				System.setProperty("org.apache.tomcat.util.net.PORT", "" + DEFAULT_HTTP_PORT);
			}

			String hostname = System.getProperty("org.apache.tomcat.util.net.ADDRESS");
			if (hostname == null) {
				hostname = "0.0.0.0";
				System.setProperty("org.apache.tomcat.util.net.ADDRESS", hostname);
			}
			// Setting the address
			service.setAddress(new InetSocketAddress(hostname, port));

			// TODO finish configuration setup

			// Starting the web connector service
			service.start();
			services.add(service);

			// Add the static node somewhere and otherwise add the MCM one.
			// Adding node web connector service

			protocol = System.getProperty("http-protocol", DEFAULT_MCM_PROTOCOL);
			scheme = System.getProperty("org.jboss.cluster.proxy.http11.SCHEME", DEFAULT_SCHEME);
			// Creating the web connector service
			WebConnectorService nodeService = new WebConnectorService(protocol, scheme,
					new MCMNodeService());
			// configure the web connector service

			// Setting the address (host:port)
			int mcmPort = DEFAULT_MCM_PORT;
			String mcmPortStr = System.getProperty("org.jboss.cluster.proxy.net.PORT");
			if (mcmPortStr != null) {
				try {
					mcmPort = Integer.valueOf(mcmPortStr);
				} catch (Throwable t) {
					logger.error(t.getMessage(), t);
					System.setProperty("org.jboss.cluster.proxy.net.PORT", "" + DEFAULT_MCM_PORT);
				}
			} else {
				System.setProperty("org.jboss.cluster.proxy.net.PORT", "" + DEFAULT_MCM_PORT);
			}

			// Retrieve the MCMP hostname
			String mcmHostname = System.getProperty("org.jboss.cluster.proxy.net.ADDRESS");
			if (mcmHostname == null) {
				mcmHostname = "0.0.0.0";
				System.setProperty("org.jboss.cluster.proxy.net.ADDRESS", mcmHostname);
			}

			nodeService.setAddress(new InetSocketAddress(mcmHostname, mcmPort));

			// TODO finish configuration setup

			// Starting the web connector service
			nodeService.start();
			services.add(nodeService);

		} catch (Throwable e) {
			logger.error("creating protocol handler error", e);
			e.printStackTrace();
			System.exit(-1);
		}

		threads.add(new Thread(new CLI(System.out)));

		time = System.currentTimeMillis() - time;
		logger.info("JBoss Mod Cluster Proxy started in " + time + "ms");
		// Add shutdown hook
		addShutdownHook();
		// Start all threads
		startThreads();
	}