Response convertResponse(HttpURLConnection connection, Request request) throws IOException {
      int status = connection.getResponseCode();
      String reason = connection.getResponseMessage();

      if (status < 0) {
        throw new IOException(
            format(
                "Invalid status(%s) executing %s %s",
                status, connection.getRequestMethod(), connection.getURL()));
      }

      Map<String, Collection<String>> headers = new TreeMap<>(CASE_INSENSITIVE_ORDER);
      for (Map.Entry<String, List<String>> field : connection.getHeaderFields().entrySet()) {
        // response message
        if (field.getKey() != null) {
          headers.put(field.getKey(), field.getValue());
        }
      }

      Integer length = connection.getContentLength();
      if (length == -1) {
        length = null;
      }
      InputStream stream;
      if (status >= 400) {
        stream = connection.getErrorStream();
      } else {
        stream = connection.getInputStream();
      }
      if (stream != null && this.isGzip(headers.get(CONTENT_ENCODING))) {
        stream = new GZIPInputStream(stream);
      } else if (stream != null && this.isDeflate(headers.get(CONTENT_ENCODING))) {
        stream = new InflaterInputStream(stream);
      }
      return Response.builder()
          .status(status)
          .reason(reason)
          .headers(headers)
          .request(request)
          .body(stream, length)
          .build();
    }
Create a new client.

@param sslContextFactory SSLSocketFactory for secure https URL connections.
@param hostnameVerifier the host name verifier.
@param disableRequestBuffering Disable the request body internal buffering for {@code
    HttpURLConnection}.
core/src/main/java/feign/Client.java