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. 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