6

Jmeter response code getting error:

Response code: Non HTTP response code: java.net.SocketException

I have Done the following setting :

  1. user.properties : httpclient4.retrycount=1 and hc.parameters.file=hc.parameters
  2. hc.parameters : http.connection.stalecheck$Boolean=true
  3. Http request sampler unchecked “Use Keep alive” also (as authentication takes more than 10 minutes for 100 users and above and I am not interested that how much time this authentication takes place)

Query : httpclient4.retrycount=1 , value should be set to 1 for n no. of request or no value ?

Nachiket Kate
  • 8,039
  • 2
  • 24
  • 42
neetu
  • 75
  • 1
  • 1
  • 4
  • I was getting "Response code: Non HTTP response code: java.net.SocketException" , after searching on the web got the views that by doing the above setting will not get the error , did all the setting but still getting the same error – neetu Oct 15 '15 at 07:39
  • Maybe this can help you http://stackoverflow.com/questions/30745350/why-am-i-receiving-response-code-non-http-response-code-java-net-socketexcepti/30747112#30747112 Check if same problem is with you. Else check if server is running or not or if it overloaded. – Nachiket Kate Oct 15 '15 at 14:09
  • Thanks for the response, could you please tell how to check the whether the server is overloaded or not ? – neetu Oct 16 '15 at 01:58
  • If its a windows server then check with perfmon utility. if its linux/unix then check with sar, top, vmstat and lot of other are present. First thing I would suggest is check server logs. you will find error logs there. – Nachiket Kate Oct 16 '15 at 06:55

2 Answers2

3

I am not sure, are you getting this error during load test or even in debugging mode?

  1. If you are debugging then better to use normal thread group with Thread as 1 Ramp-up as 1 Loop as 1

and add Listner > View Result Tree then run script and check response.

  1. If above is passed without giving any errors

Reason for socket exception in Client-Server Application : It consists of two threads. The first one, SimpleServer, opens a socket on the local machine on port 3333. Then it waits for a connection to come in. When it finally receives a connection, it creates an input stream out of it, and simply reads one line of text from the client that was connected. The second thread, SimpleClient, attempts to connect to the server socket that SimpleServer opened. When it does so, it sends a line of text and that’s it. This time though the two threads will be in different classes launched by two different main methods, so as to cause a SocketEception

So, might be you are using lot many threads with very low ramp-up time in script.

If you can provide more details about problem, it will be great.

Parvez
  • 389
  • 1
  • 3
  • 11
0

It generally comes when port which you are using for request call (APIs), is not open in the firewall. Check the same API with other applications like Postman or Browser.

sometimes setting JAVA_OPTIONS also solves the problem:

setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true

Hit the above command from the command line.

Ankit Gupta
  • 627
  • 4
  • 11