Hi sebb, in your place, I would implement a new ProtocolSocketFactory along with a new socket (wrapper) that throttles bandwidth.
hope that helps, Roland sebb <[EMAIL PROTECTED]> 16.11.2005 01:33 Please respond to "HttpClient Project" To [email protected] cc Subject Simulating a slow (modem) connection I've been looking at how one might simulate a slow connection (e.g. dialup modem) in HttpClient. This is for use with JMeter. The idea is to intercept the read and write calls, and insert delays according to the desired throughput. One way to do this seems to be to subclass HttpConnection, and pass that to the Method.execute() call. I have found that one can easily deal with the writes by overriding the inbuilt write() method. Unfortunately, there is no single read() method - there is a readLine(), and I think other calls can be trapped by overriding the getResponseInput() method (which readLine() does not use). Or one could override open() and tunnelCreated(), which would allow one to replace the Input and Output streams (after they have been created) with a suitable Filter Stream. Neither is ideal - it's a shame that there is no overrideable read() method... Just wondering how easy it would be to process all read() calls through HttpConnection? Is that something that could be considered? I also saw that the Input and Output Streams are optionally wrapped in WireLog streams. Perhaps another solution would be to allow the user to provide their own WireLog Streams? Or indeed an independent Filter stream. == I can cobble something together that will work with the current 2.0.2 and 3.0 codesets, but it would be nice not to have to rely on the internal workings of the code. Thoughts? S. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
