@SuppressWarnings("unchecked")
  void validateServerBase(String theServerBase, HttpClient theHttpClient, BaseClient theClient) {

    GenericClient client = new GenericClient(myContext, theHttpClient, theServerBase, this);
    for (IClientInterceptor interceptor : theClient.getInterceptors()) {
      client.registerInterceptor(interceptor);
    }
    client.setDontValidateConformance(true);

    IBaseResource conformance;
    try {
      @SuppressWarnings("rawtypes")
      Class implementingClass =
          myContext.getResourceDefinition("Conformance").getImplementingClass();
      conformance = (IBaseResource) client.fetchConformance().ofType(implementingClass).execute();
    } catch (FhirClientConnectionException e) {
      throw new FhirClientConnectionException(
          myContext
              .getLocalizer()
              .getMessage(
                  RestfulClientFactory.class,
                  "failedToRetrieveConformance",
                  theServerBase + Constants.URL_TOKEN_METADATA),
          e);
    }

    FhirTerser t = myContext.newTerser();
    String serverFhirVersionString = null;
    Object value = t.getSingleValueOrNull(conformance, "fhirVersion");
    if (value instanceof IPrimitiveType) {
      serverFhirVersionString = ((IPrimitiveType<?>) value).getValueAsString();
    }
    FhirVersionEnum serverFhirVersionEnum = null;
    if (StringUtils.isBlank(serverFhirVersionString)) {
      // we'll be lenient and accept this
    } else {
      if (serverFhirVersionString.startsWith("0.80")
          || serverFhirVersionString.startsWith("0.0.8")) {
        serverFhirVersionEnum = FhirVersionEnum.DSTU1;
      } else if (serverFhirVersionString.startsWith("0.4")) {
        serverFhirVersionEnum = FhirVersionEnum.DSTU2;
      } else if (serverFhirVersionString.startsWith("0.5")) {
        serverFhirVersionEnum = FhirVersionEnum.DSTU2;
      } else {
        // we'll be lenient and accept this
        ourLog.debug(
            "Server conformance statement indicates unknown FHIR version: {}",
            serverFhirVersionString);
      }
    }

    if (serverFhirVersionEnum != null) {
      FhirVersionEnum contextFhirVersion = myContext.getVersion().getVersion();
      if (!contextFhirVersion.isEquivalentTo(serverFhirVersionEnum)) {
        throw new FhirClientInappropriateForServerException(
            myContext
                .getLocalizer()
                .getMessage(
                    RestfulClientFactory.class,
                    "wrongVersionInConformance",
                    theServerBase + Constants.URL_TOKEN_METADATA,
                    serverFhirVersionString,
                    serverFhirVersionEnum,
                    contextFhirVersion));
      }
    }

    myValidatedServerBaseUrls.add(normalizeBaseUrlForMap(theServerBase));
  }