class FederationServer {

    public static FederationServer createForDomain(String domain) {
        URI stellarTomlUri;
        try {
            StringBuilder uriBuilder = new StringBuilder();
            uriBuilder.append("https://");
            uriBuilder.append(domain);
            uriBuilder.append("/.well-known/stellar.toml");
            stellarTomlUri = new URI(uriBuilder.toString());
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        Toml stellarToml = null;
        try {
            Request request = new Request.Builder().get()
                    .url(stellarTomlUri.toString())
                    .build();
            Response response = httpClient.newCall(request)
                    .execute();
            if (response.code() >= 300) {
                throw new StellarTomlNotFoundInvalidException();
            }
            ResponseBody body = response.body();
            if (body == null) {
                throw new StellarTomlNotFoundInvalidException();
            }
            stellarToml = new Toml().read(body.string());
        } catch (IOException e) {
            throw new ConnectionErrorException();
        }

        String federationServer = stellarToml.getString("FEDERATION_SERVER");
        if (federationServer == null) {
            throw new NoFederationServerException();
        }

        return new FederationServer(federationServer, domain);
    }

    public  FederationServer(URL serverUri, String domain);
    public  FederationServer(String serverUri, String domain);

}