We have a couple of Cucumber test scenarios, which use RestAssured framework for hitting HTTPS endpoints. When we run the entire suite of scenarios, we face intermittent "javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated" exceptions thrown from the the following line of code
Response response = given().log().all().headers(headers).contentType(ContentType.JSON) .with().body(somebody).put(path, testId);
This is an intermittent issue, observed both in IntelliJ IDEA 13.1 and from Terminal, on Mac OSX. We are using Jayway RestAssured v2.3.2 on a gradle build.
The server we are hitting has a self-signed certificate, and we tried the following:
1) Adding the certificate to the Mac Keychain manually - still intermittent
2) Using useRelaxedHTTPSValidation() as mentioned here - still intermittent
3) Using the following in the code
RestAssured.config = RestAssured.config().sslConfig(sslConfig().allowAllHostnames());
from the same blog post - all tests fail with the above exception consistently
Any help/pointers would be greatly appreciated.