JMeter Non HTTP response message: Unconnected sockets not implemented

If you’re testing HTTPS with JMeter 2.3.2 and a current version of Java greater than 1.5 e.g.

java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

Then you are likely to encounter this error when using the standard HTTP Request sampler:

Response code: Non HTTP response code: java.net.SocketException
Response message: Non HTTP response message: Unconnected sockets not implemented

If you have the opportunity, use the HTTP Request HTTPClient sampler instead and this problem should be resolved. Otherwise use Java 1.5 instead. If you’ve already recorded your test plan in JMeter or other tools (like BadBoy) then some simple regular expressions on the jmx file will fix the problem manually.

Windows:

ruby -pi.bak -e "gsub(/

ruby -pi.bak -e "gsub(/HTTPSampler>/, 'HTTPSampler2>')" *.jmx

Mac:

ruby -pi.bak -e "gsub(/

ruby -pi.bak -e "gsub(/HTTPSampler>/, 'HTTPSampler2>')" *.jmx

Read More

Regex Search and Replace in LoadRunner

Previously I identified how to setup pattern matching with Regex in LoadRunner.

Here’s how you implement search and replace functionality with the same POSIX libraries used in the previous example.

Create a replace function in your favourite headers file or wherever you keep your framework’y stuff… You also need the pcre3.dll and pcreposix.h header added as files to your script.

replace(const char *string, char *pattern, char *replace, char *match)
{
 
   int length;
   int  status;
   int  eflag;
   char buf[1024] = "";
   char out[1024] = "";
 
   regex_t re;
   regmatch_t pmatch[128];
   lr_load_dll("pcre3.dll");
 
   if((status = regcomp(&re, pattern, REG_EXTENDED)) != 0){
      regerror(status, &re, buf, 120);
      lr_output_message("Match PCRE Exit 2");
      return 2;
   }
 
   while(status = regexec( &re, string, 1, pmatch, eflag)== 0){
      strncat(out, string, pmatch[0].rm_so);
      strcat(out, replace);
      string += pmatch[0].rm_eo;
      eflag = REG_NOTBOL;
   }
   strcat(out, string);
   lr_save_string(out, match);
}

Then anywhere in your actions you can call on this function, passing it the string buffer you wish to operate on, a search value, a replace value and the name of the LoadRunner parameter you want the result saved into.

lr_save_string("FOO%20BAR%20DING", "buffer");
replace(lr_eval_string("{buffer}"),"%20"," ", "custom");

What you’ll end up with is something like this:


Home.c(6): Notify: Saving Parameter "buffer = FOO%20BAR%20DING"
Home.c(7): Notify: Parameter Substitution: parameter "buffer" = "FOO%20BAR%20DING"
framework.h(135): Notify: Saving Parameter "custom = FOO BAR DING"

Enjoy.

Read More

Improved SPNEGO or Kerberos support with LoadRunner

Previously I identified a way in which to test SPNEGO or Kerberos authentication with LoadRunner. However this implementation was buggy in the sense that if you ran your load tests under reasonable load with the WinInet replay engine (instead of sockets) you were likely to encounter the following error:

Error -27492: "HttpSendRequest" failed, Windows error code=12057 (certificate revoked) and retry limit (0) exceeded for URL="
https://someplacesecure.com.au/secure.html", Snapshot Info [MSH 1 2]

This error occurs when using WinInet replay instead of sockets with Integrated Authentication enabled in run-time settings. The purpose of this was to allow vusers to use SSO with SPNEGO authentication in an IBM WebSEAL environment.

After spending some time with the mystical HP level 3 support, they identified an undocumented flag which helps out significantly in this. So, instead of using the WinInet replay engine (which is not encouraged by HP) you should do something similar to the following.

vuser_init()
{
 
	// Preferred run-time settings
	// Browser -> Browser Emulation
       // [ ] Simulate a new user on each iteration
       // Preferences -> Options
       // Enable Integration Authentication [Yes]
 
	web_set_sockets_option("INITIAL_BASIC_AUTH","1");
 
	web_set_user("DOMAIN.LOCAL\\username",
		"password",
		"someplacesecure.com.au:443");
 
	web_url("myportal",
		"URL=https://someplacesecure.com.au/wps",
		"Resource=0",
		"Referer=",
		"Mode=HTML",
		LAST);
 
	return 0;
}

The magic is in the web_set_sockets_option("INITIAL_BASIC_AUTH","1") flag. Set that and you can then use LoadRunner in Sockets mode which as it turns out, is much more stable.

Enjoy.

Read More