public Service(Server server, String key, String type, Map<?, ?> config) throws Exception {
		log.info("Setting up the service for {}", key.length() == 0 ? "*" : key);
		
		this.server = server;
		this.key = key;
		this.type = type;
		
		log.debug("Finding the name");
		Object obj = config.get("name");
		if (!(obj instanceof String))
			throw new Exception("Problem loading configuration: hosts > host > name");
		this.name = (String) obj;
		
		log.debug("Finding the host name");
		String host;
		obj = config.get("host");
		if (obj == null)
			host = "localhost";
		else if (!(obj instanceof String))
			throw new Exception("Problem loading configuration: hosts > host > host");
		else
			host = (String) obj;
		
		log.debug("Finding the host port");
		obj = config.get("port");
		if (!(obj instanceof Number))
			throw new Exception("Problem loading configuration: hosts > host > port");
		Number port = (Number) obj;

		log.debug("Creating the host address");
		this.addr = new InetSocketAddress(host, port.intValue());
	}