thanx alot for the hints. u're always soooo helpfull khiemu
On Sat, Apr 30, 2011 at 1:29 PM, Oleg Kalnichevski <[email protected]> wrote: > On Sat, 2011-04-30 at 01:13 +0200, khiem nguyen wrote: > > Hi, > > > > i want to throttle the download-traffic/bandwidth with httpclient. > Googling > > around doesn't takes me further. > > 1 of the found options is using Thread.sleep(time) while reading from > > inputstream. > > looking into the source-code, i think i'll have to extends > > SocketHttpClientConnection, go to SocketInputBuffer where i can use the > > built-in TransportMetrics to set/reset the transferered traffic & put the > > Thread.sleep there. > > but it couldnt figure out how to do this quick from defaulthttpclient & > how > > to "wire" things together. > > is this this approach correct ? if yes , it would be great if someone > could > > give me some clues about this. > > > > & what about sslsocket ? do i have also have to touch schemefactory ? > > > > is there any other options /suggestions > > > > thanx alot > > > > Probably the best (or the easiest) approach is to do the I/O throttling > on the socket level. You would need to implement a custom Socket class > and plug it in using a custom SchemeSocketFactory. > > Actually you can borrow most of the code from JMeter's Slow* classes: > > > http://svn.apache.org/repos/asf/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowSocket.java > > http://svn.apache.org/repos/asf/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowSSLSocket.java > > http://svn.apache.org/repos/asf/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowInputStream.java > > http://svn.apache.org/repos/asf/jakarta/jmeter/trunk/src/core/org/apache/jmeter/util/SlowOutputStream.java > > Oleg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
