Search code examples
apacheproxyjmeterntlm

NTLM Authentication with JMeter is receiving a SocketException


I'm trying to load test a SSO request with JMeter (version 2.13). I followed this tutorial and set up an HTTP Authorization Manager with Username, Password, Domain and Mechanism = BASIC_DIGEST.

When I set the proxy server settings of my HTTP Request to Server Name or IP = 127.0.0.1 and Port Number = 8888, I can see my request go through fiddler where it gets two 401 responses and then succeeds. This shows up in the JMeter View Results Tree as a single successful request. However, when I remove the proxy server settings, the request fails and I get the following response:

java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at sun.security.ssl.InputRecord.readFully(Unknown Source)
    at sun.security.ssl.InputRecord.read(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:436)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
    at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:107)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
    at java.lang.Thread.run(Unknown Source)

The log viewer also says this:

org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$6: I/O exception (java.net.SocketException) caught when connecting to the target host: Connection reset

I have been trying all sorts of things to get this working without the proxy settings including using the HttpClient4 implementation, setting the following in user.properties

hc.parameters.file=hc.parameters

and the following in httpclient.parameters

http.protocol.reject-relative-redirect$Boolean=true

I will also note that when I run the test through Fiddler, I get a prompt asking if I want to ignore remote certificate errors

Session #106: The remote server (server name here) presented a certificate that did not validate, due to RemoteCertificateChainErrors.
0 - Unknown error.

I am assuming this won't make any difference in JMeter as I read that JMeter HTTP samplers are configured to accept all certificates.

Any help getting this up and running (without Fiddler) would be much appreciated.


Solution

  • The problem was that the Secure Credential Store I was trying to connect to required TLS version 1.0. I had to tell JMeter to use this by updating the jmeter.properties file with:

    https.default.protocol=TLS
    https.socket.protocols=TLSv1