class HostInfo {

    public static HostInfo buildFromEndpoint(final String endPoint) {
        if (endPoint == null || endPoint.trim().isEmpty()) {
            return null;
        }

        final String host = getHost(endPoint);
        final Integer port = getPort(endPoint);

        if (host == null || port == null) {
            throw new ConfigException(
                String.format("Error parsing host address %s. Expected format host:port.", endPoint)
            );
        }
        return new HostInfo(host, port);
    }

    public  HostInfo(final String host,
                    final int port);

}