Infinity
Infinity

Reputation: 3441

Gatling, catching SSL exceptions

I have Spring service hosted on Jetty and I want to test that it doesn't allow users to connect with invalid certificates.

scenario("Authenticate using expired client certificate")
   .exec(session => session.setAll(
       Map("gatling.http.ssl.keyStore.file" -> "expiredCertificateKeystore.jks", 
           "gatling.http.ssl.trustStore.file" -> "truststore.jks"))
   .exec(
       http("GET / request")
          .get("/")
          .check(/*that IOException is thrown*/)
)

Since Jetty cuts connection because of expected java.security.cert.CertificateExpiredException while connecting with invalid certificate, Gatling's HTTP client doesn't receive any return code from server and throws java.io.IOException: Remotely closed

Is there any way to tell Gatling that this error is expected and this behavior should be considered as success? I could not find any documentation about such feature.

Upvotes: 1

Views: 929

Answers (1)

Stephane Landelle
Stephane Landelle

Reputation: 7038

No, it's not possible to recover IO exceptions. What you're doing is a functional test, not a load test one, which is fine, but we didn't consider this use case.

Upvotes: 1

Related Questions