harishch1998 commented on code in PR #10052:
URL: https://github.com/apache/iceberg/pull/10052#discussion_r1554325691


##########
core/src/test/java/org/apache/iceberg/rest/TestHTTPClient.java:
##########
@@ -121,6 +128,92 @@ public void testHeadFailure() throws 
JsonProcessingException {
     testHttpMethodOnFailure(HttpMethod.HEAD);
   }
 
+  /** Tests that requests go via the proxy server in case the client is set up 
with one */
+  @Test
+  public void testHttpClientProxyServerInteraction() throws IOException {
+    int proxyPort = 1070;
+    String proxyHostName = "localhost";
+    try (ClientAndServer proxyServer = startClientAndServer(proxyPort);
+        RESTClient clientWithProxy =
+            HTTPClient.builder(ImmutableMap.of())
+                .uri(URI)
+                .withProxy(proxyHostName, proxyPort)
+                .build()) {
+      //  Set up the servers to match against a provided request
+      String path = "v1/config";
+
+      HttpRequest mockRequest =
+          request("/" + 
path).withMethod(HttpMethod.HEAD.name().toUpperCase(Locale.ROOT));
+
+      HttpResponse mockResponse = response().withStatusCode(200);
+
+      mockServer.when(mockRequest).respond(mockResponse);
+      proxyServer.when(mockRequest).respond(mockResponse);
+
+      restClient.head(path, ImmutableMap.of(), (onError) -> {});
+      mockServer.verify(mockRequest, VerificationTimes.exactly(1));
+      proxyServer.verify(mockRequest, VerificationTimes.never());

Review Comment:
   Makes sense



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to