class HttpProxy {

    public HttpResponse get(Application application, String hostName, String serviceType, String relativePath) {
        HostInfo host = application.getModel().getHosts().stream()
                .filter(hostInfo -> hostInfo.getHostname().equals(hostName))
                .findFirst()
                .orElseThrow(() -> new NotFoundException("Failed to find host " + hostName));

        ServiceInfo service = host.getServices().stream()
                .filter(serviceInfo -> serviceType.equals(serviceInfo.getServiceType()))
                .findFirst()
                .orElseThrow(() -> new NotFoundException("Failed to find any service of type " + serviceType
                        + " on host " + hostName));

        // "http" and "state" seems to uniquely identify an interesting HTTP port on each service
        PortInfo port = service.getPorts().stream()
                .filter(portInfo -> portInfo.getTags().stream().collect(Collectors.toSet()).containsAll(
                        Stream.of("http", "state").collect(Collectors.toSet())))
                .findFirst()
                .orElseThrow(() -> new NotFoundException("Failed to find HTTP state port"));

        return internalGet(host.getHostname(), port.getPort(), relativePath);
    }

    @Inject public  HttpProxy();
    public  HttpProxy(HttpFetcher fetcher);

}