hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Simulating a slow (modem) connection
Date Wed, 16 Nov 2005 00:33:35 GMT
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.



To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org

View raw message