code: protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Class<T> responseClass) throws IOException {
          T body = null;
  
          HttpEntity entity = response.getEntity();
          if (entity != null && responseClass != null) {
              try (InputStream inputStream = entity.getContent()) {
                  try {
                      body = Serialiser.deserialise(inputStream, responseClass);
                  } catch (JsonSyntaxException e) {
                      // This can happen if an error HTTP code is received and the
                      // body of the response doesn't contain the expected object:
                      body = null;
                  }
              }
          } else {
              EntityUtils.consume(entity);
          }
  
          return body;
      }
docs: Deserialises the given {@link CloseableHttpResponse} to the specified type.
  
  @param response      The response.
  @param responseClass The type to deserialise to. This can be null, in which case {@link EntityUtils#consume(HttpEntity)} will be used to consume the response body (if any).
  @param <T>           The type to deserialise to.
  @return The deserialised response, or null if the response does not contain an entity.
  @throws IOException If an error occurs.