@Override
  public Response<GetBinaryValue> getKVBinaryValue(
      String key, String token, UrlParameters UrlParameters) {
    UrlParameters tokenParams = token != null ? new SingleUrlParameters("token", token) : null;
    RawResponse rawResponse = rawClient.makeGetRequest("/v1/kv/" + key, tokenParams, UrlParameters);

    if (rawResponse.getStatusCode() == 200) {
      List<GetBinaryValue> value =
          GsonFactory.getGson()
              .fromJson(
                  rawResponse.getContent(), new TypeToken<List<GetBinaryValue>>() {}.getType());

      if (value.size() == 0) {
        return new Response<GetBinaryValue>(null, rawResponse);
      } else if (value.size() == 1) {
        return new Response<GetBinaryValue>(value.get(0), rawResponse);
      } else {
        throw new ConsulException("Strange response (list size=" + value.size() + ")");
      }
    } else if (rawResponse.getStatusCode() == 404) {
      return new Response<GetBinaryValue>(null, rawResponse);
    } else {
      throw new OperationException(rawResponse);
    }
  }
  @Override
  public Response<Void> catalogDeregister(CatalogDeregistration catalogDeregistration) {
    String json = GsonFactory.getGson().toJson(catalogDeregistration);

    RawResponse rawResponse = rawClient.makePutRequest("/v1/catalog/deregister", json);
    if (rawResponse.getStatusCode() == 200) {
      return new Response<Void>(null, rawResponse);
    } else {
      throw new OperationException(rawResponse);
    }
  }
  @Override
  public Response<CatalogNode> getCatalogNode(String nodeName, QueryParams queryParams) {
    RawResponse rawResponse = rawClient.makeGetRequest("/v1/catalog/node/" + nodeName, queryParams);

    if (rawResponse.getStatusCode() == 200) {
      CatalogNode catalogNode =
          GsonFactory.getGson().fromJson(rawResponse.getContent(), CatalogNode.class);
      return new Response<CatalogNode>(catalogNode, rawResponse);
    } else {
      throw new OperationException(rawResponse);
    }
  }
  @Override
  public Response<List<Node>> getCatalogNodes(QueryParams queryParams) {
    RawResponse rawResponse = rawClient.makeGetRequest("/v1/catalog/nodes", queryParams);

    if (rawResponse.getStatusCode() == 200) {
      List<Node> value =
          GsonFactory.getGson()
              .fromJson(rawResponse.getContent(), new TypeToken<List<Node>>() {}.getType());
      return new Response<List<Node>>(value, rawResponse);
    } else {
      throw new OperationException(rawResponse);
    }
  }
  @Override
  public Response<List<String>> getCatalogDatacenters() {
    RawResponse rawResponse = rawClient.makeGetRequest("/v1/catalog/datacenters");

    if (rawResponse.getStatusCode() == 200) {
      List<String> value =
          GsonFactory.getGson()
              .fromJson(rawResponse.getContent(), new TypeToken<List<String>>() {}.getType());
      return new Response<List<String>>(value, rawResponse);
    } else {
      throw new OperationException(rawResponse);
    }
  }
  @Override
  public Response<Boolean> setKVBinaryValue(
      String key, byte[] value, String token, PutParams putParams, UrlParameters UrlParameters) {
    UrlParameters tokenParam = token != null ? new SingleUrlParameters("token", token) : null;
    RawResponse rawResponse =
        rawClient.makePutRequest("/v1/kv/" + key, value, putParams, tokenParam, UrlParameters);

    if (rawResponse.getStatusCode() == 200) {
      boolean result = GsonFactory.getGson().fromJson(rawResponse.getContent(), boolean.class);
      return new Response<Boolean>(result, rawResponse);
    } else {
      throw new OperationException(rawResponse);
    }
  }
  @Override
  public Response<List<GetValue>> getKVValues(
      String keyPrefix, String token, UrlParameters UrlParameters) {
    UrlParameters recurseParam = new SingleUrlParameters("recurse");
    UrlParameters tokenParam = token != null ? new SingleUrlParameters("token", token) : null;
    RawResponse rawResponse =
        rawClient.makeGetRequest("/v1/kv/" + keyPrefix, recurseParam, tokenParam, UrlParameters);

    if (rawResponse.getStatusCode() == 200) {
      List<GetValue> value =
          GsonFactory.getGson()
              .fromJson(rawResponse.getContent(), new TypeToken<List<GetValue>>() {}.getType());
      return new Response<List<GetValue>>(value, rawResponse);
    } else if (rawResponse.getStatusCode() == 404) {
      return new Response<List<GetValue>>(null, rawResponse);
    } else {
      throw new OperationException(rawResponse);
    }
  }
  @Override
  public Response<List<com.ecwid.consul.v1.catalog.model.CatalogService>> getCatalogService(
      String serviceName, String tag, QueryParams queryParams) {
    UrlParameters tagParam = tag != null ? new SingleUrlParameters("tag", tag) : null;
    RawResponse rawResponse =
        rawClient.makeGetRequest("/v1/catalog/service/" + serviceName, tagParam, queryParams);

    if (rawResponse.getStatusCode() == 200) {
      List<com.ecwid.consul.v1.catalog.model.CatalogService> value =
          GsonFactory.getGson()
              .fromJson(
                  rawResponse.getContent(),
                  new TypeToken<
                      List<com.ecwid.consul.v1.catalog.model.CatalogService>>() {}.getType());
      return new Response<List<com.ecwid.consul.v1.catalog.model.CatalogService>>(
          value, rawResponse);
    } else {
      throw new OperationException(rawResponse);
    }
  }