You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by An...@ipaustralia.gov.au on 2002/09/06 07:43:09 UTC
Using Proxy v. Auth Manager in JMeter
Hi All,
can anyone tell me the difference between using Proxy setting at start up
and using the authManager in a test plan. I have an issue where if I use a
simple piece of code see below to access a web page it works, but through
JMeter (which I know uses the java.net. classes) to open the same URL
nothing happens.
thanks
Andrew.
URL url = new URL(urlName);
HttpURLConnection uc =
(HttpURLConnection)url.openConnection();
// the following line makes URLConnection look
like MSIE
uc.setRequestProperty("User-Agent", "Mozilla/4.0
(compatible; MSIE 5.01; Windows NT)");
uc.setRequestMethod("GET");
// the following three lines calculate a
BASE64-encoded username/password for the proxy
String userName = ""; // put your proxy/internet
username here
String passWord = ""; // put your proxy/internet
password here
String auth = "Basic " + new
sun.misc.BASE64Encoder().encode((userName + ":" + passWord).getBytes());
// comment out the following three lines to switch
off proxy access
uc.setRequestProperty("Proxy-Authorization", auth);
System.setProperty("http.proxyHost",
"proxy.xxx.xxx");
System.setProperty("http.proxyPort", "XXX");
Re: Using Proxy v. Auth Manager in JMeter
Posted by Mike Stover <ms...@apache.org>.
It sounds like you have a proxy server that requires login info? JMeter was
recently upgraded to handle this - when you set the proxy server and port on the
command line when starting JMeter, you can also set the username and password.
You can read about it at:
http://jakarta.apache.org/jmeter/usermanual/get-started.html#running
-Mike
On 6 Sep 2002 at 15:43, Andrew.Hammond@ipaustralia.gov.au wrote:
> Hi All,
>
> can anyone tell me the difference between using Proxy setting at start up
> and using the authManager in a test plan. I have an issue where if I use a
> simple piece of code see below to access a web page it works, but through
> JMeter (which I know uses the java.net. classes) to open the same URL
> nothing happens.
>
> thanks
>
> Andrew.
>
>
> URL url = new URL(urlName);
>
> HttpURLConnection uc =
> (HttpURLConnection)url.openConnection();
>
> // the following line makes URLConnection look
> like MSIE
> uc.setRequestProperty("User-Agent", "Mozilla/4.0
> (compatible; MSIE 5.01; Windows NT)");
>
> uc.setRequestMethod("GET");
>
> // the following three lines calculate a
> BASE64-encoded username/password for the proxy
>
> String userName = ""; // put your proxy/internet
> username here
> String passWord = ""; // put your proxy/internet
> password here
> String auth = "Basic " + new
> sun.misc.BASE64Encoder().encode((userName + ":" + passWord).getBytes());
>
> // comment out the following three lines to switch
> off proxy access
> uc.setRequestProperty("Proxy-Authorization", auth);
> System.setProperty("http.proxyHost",
> "proxy.xxx.xxx");
> System.setProperty("http.proxyPort", "XXX");
--
Michael Stover
mstover1@apache.org
Yahoo IM: mstover_ya
ICQ: 152975688
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>