public IPolicyProbeResponse probePolicy(String orgId, String apiId, String apiVersion, int idx, String apiKey, String rawPayload) throws GatewayAuthenticationException {
        InputStream probeResponseIs = null;
        try {
            UriBuilder probeUrl = UriBuilder.fromUri(endpoint)
                    .path("organizations")
                    .path(orgId)
                    .path("apis")
                    .path(apiId)
                    .path("versions")
                    .path(apiVersion)
                    .path("policies")
                    .path(String.valueOf(idx));
            if (apiKey != null && !apiKey.isBlank()) {
                probeUrl.queryParam("apiKey", apiKey);
            }
            HttpPost post = new HttpPost(probeUrl.build());
            post.setHeader("Content-Type", MediaType.APPLICATION_JSON);
            HttpEntity entity = new ByteArrayEntity(rawPayload.getBytes(StandardCharsets.UTF_8), ContentType.APPLICATION_JSON);
            post.setEntity(entity);
            HttpResponse response = httpClient.execute(post);
            int actualStatusCode = response.getStatusLine().getStatusCode();
            if (actualStatusCode == 401 || actualStatusCode == 403) {
                throw new GatewayAuthenticationException();
            } else if (!(actualStatusCode / 100 == 2)) {
                throw new RuntimeException("System status check failed: " + actualStatusCode + ": " + response.getStatusLine()); //$NON-NLS-1$
            }
            probeResponseIs = response.getEntity().getContent();
            return ProbeRegistry.deserialize(probeResponseIs);
        } catch (GatewayAuthenticationException | RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            IOUtils.closeQuietly(probeResponseIs);
        }
    }
Constructor.
@param endpoint the endpoint
@param httpClient the http client
manager/api/gateway/src/main/java/io/apiman/manager/api/gateway/rest/GatewayClient.java