Hello Martin,

> I need to throttle HTTP connections to limit bandwidth. Now I can throttle 
> all 
> connections using some protocol by using 
> org.apache.jmeter.protocol.http.util.SlowHttpClientSocketFactory and 
> Protocol.register(). But this is not sufficient to me. What I need is to be 
> able to set different limit before each HttpMethod execution.

If you are using server-relative paths, you can pass the HostConfiguration
to be used explicitly to HttpClient:
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpClient.html#executeMethod(org.apache.commons.httpclient.HostConfiguration,%20org.apache.commons.httpclient.HttpMethod)
In that case, the Protocol instance will be taken from the HostConfiguration
argument, and you can pass in any protocol (and protocol socket factory) you
want to be used for this method specifically.

Otherwise, there's always the ugly trick of using a ThreadLocal variable
that is set before calling the execute method and read by the protocol
socket factory to decide how much to throttle, if at all.

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to