On Oct 12, 2017 02:48, "Oleg Kalnichevski" <ol...@apache.org> wrote:

On Mon, 2017-10-09 at 23:19 +0200, Philippe Mouawad wrote:
> Hello,
> Within JMeter projet I am working on migration fully to last APIs of
> HttpClient:
>
>    - https://bz.apache.org/bugzilla/show_bug.cgi?id=58757
>
> You can see current code here:
>
>    - https://github.com/ubikloadpack/jmeter/tree/HC4_FULL_MIGRATION
>
> I have nearly completed the work except for 2 remaining items:
>
>    - Virtual Host:
>       - I don't see this parameter in newer interfaces
>          -
>          https://github.com/apache/jmeter/blob/trunk/src/protocol/htt
> p/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L1117
>

The virtual parameter in HC 4.x was a left-over from HC 3.x. It should
have never been introduced in the first place.

Please consider executing requests with an explicit target HttpHost and
a 'virtual' host in the request URI.

https://github.com/apache/httpcomponents-client/blob/master/httpclient5
/src/main/java/org/apache/hc/client5/http/classic/HttpClient.java#L95

HttpHost should represent a physical host, whereas request URI may
contain any arbitrary host name.

---
HttpHost target = new HttpHost("www.google.com");
HttpGet httpGet = new HttpGet("http://google.ru/";);
CloseableHttpResponse response = client.execute(target, httpGet);
---


>
>    - "Slow " connection feature:
>       - This feature allows to simulate slow connection. Currently we
> wrap
>       Input/Output stream returned by socket with
> SlowInputStream/SlowOutputStream
>       -
>          https://github.com/apache/jmeter/blob/trunk/src/protocol/htt
> p/org/apache/jmeter/protocol/http/util/SlowHC4SocketFactory.java
>          -
>          https://github.com/apache/jmeter/blob/trunk/src/protocol/htt
> p/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L322
>          -
>          https://github.com/apache/jmeter/blob/trunk/src/protocol/htt
> p/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L892
>       - It is not clear for me how this feature should be
> implemented:
>          - Should we adapt SSLSocket and Socket with a Slow feature ?
>
>
> Hope you can help by pointing me to the components.
>

I think all you need to do is to extend PlainConnectionSocketFactory or
provide a custom one and return a 'slow' socket from #createSocket
method.


Maybe this could be a contribution in our test code? It does not seem to
really belong in main... unless it is used to enable throttling which seems
like a neat idea for any server. So I would put in it main, but that's just
me.

Gary


https://github.com/apache/httpcomponents-client/blob/master/httpclient5
/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketF
actory.java

Hope this helps

Oleg


> Thanks
>
> Regards
>
> Philippe M.
>
> @philmdot

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to