On Thu, 2025-01-09 at 19:14 -0500, Sneha Murganoor wrote: > Dear HttpClient Users, > > I am using an Apache HttpClient5 to make CONNECT requests through an > HTTP > tunneling forward proxy. I would like to measure the backend latency > after > the tunnel connection is established between the proxy and the target > server. > > Specifically, is there a way to determine the duration between: > > 1. The proxy client establishing the tunnel connection with the > target > server, and > 2. The client receiving the first byte of the response from the > target > server? > > Thank you for your assistance. > > Best regards, > Sneha
Hi Sneha I am not sure what you mean by the first byte of the response but I presume the receipt of the response message head is what you actually want. This is one can introduce performance probes into the message processing pipeline ``` HttpClients.custom() .setRequestExecutor(new HttpRequestExecutor( Http1Config.DEFAULT, DefaultConnectionReuseStrategy.INSTANCE, new Http1StreamListener() { @Override public void onRequestHead(final HttpConnection connection, final HttpRequest request) { System.out.println(request.getMethod() + " " + request.getRequestUri() + " " + Instant.now()); } @Override public void onResponseHead(final HttpConnection connection, final HttpResponse response) { System.out.println(response.getCode() + " " + Instant.now()); } @Override public void onExchangeComplete(final HttpConnection connection, final boolean keepAlive) { } })).build(); ``` This should give you access to both the proxy tunnel connection message exchange and the request / response exchange with the target server. Hope this helps Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org