title: PKIX Path Building failed after upgrading from 0.9.6 to 1.0.x karate version
body: <p>I was trying to upgrade our working Karate tests from the 0.9.6 karate version to the 1.0.x version.  I have defined the Keystores and truststores in the feature file using the ssl configuration and they work fine in the 0.9.6 version of karate.  When I change to utilize the 1.0.x version of karate, I receive a PKIX Path Building failure:</p>
  <blockquote>
  <p>javax.net.ssl|ERROR|1B|pool-1-thread-1|2021-05-22 17:18:20.212
  CDT|TransportContext.java:318|Fatal (CERTIFICATE_UNKNOWN): PKIX path
  building failed:
  sun.security.provider.certpath.SunCertPathBuilderException: unable to
  find valid certification path to requested target ( &quot;throwable&quot; : {<br />
  sun.security.validator.ValidatorException: PKIX path building failed:
  sun.security.provider.certpath.SunCertPathBuilderException: unable to
  find valid certification path to requested target</p>
  </blockquote>
  <p>I've added breakpoints in the karate ApacheHttpClient class and I can see that the Keystore and TrustStores are being set, as well as verifying that the trusted certs are being added as trusted certificates when running with -Djavax.net.debug=all.</p>
  <p>I've even added the specific server cert that is being sent to the trust store.  I cannot seem to find the root cause  of why I am receiving a PKIX failure on the 1.0.x version of karate, yet the exact same configuration works fine in the 0.9.6 version.  I have also validated the CAs from the full chain of the server cert being sent is included in my trust store.  It seems that maybe my trust store is being ignored once the request is sent.</p>
  <p>Any thoughts about what might be different for TLS connections in karate 1.0.x?  As far as I can tell from the docs, the ssl configuration options have not changed.</p>
  <hr />
  <p>Reproduced with Karate Demo: <a href="https://github.com/intuit/karate/tree/v1.0.1/karate-demo/src/test/java/ssl" rel="nofollow noreferrer">https://github.com/intuit/karate/tree/v1.0.1/karate-demo/src/test/java/ssl</a></p>
  <p>I made some tweaks to the karate demo SSL tests to show the issue with having Scenario Outline and the connectTimeout or readTimeout set:</p>
  <p>karate-config.js:</p>
  <pre><code>function fn() {
    karate.configure('connectTimeout', 5000);
    karate.configure('readTimeout', 5000);
    var port = karate.properties['demo.server.port'] || '8080';
    var protocol = 'http';
    if (karate.properties['demo.server.https'] === 'true') {
      protocol = 'https';
      karate.configure('ssl', true);
    }
    var config = { demoBaseUrl: protocol + '://127.0.0.1:' + port };
    if (karate.env !== 'mock') {
      // karate.configure('callSingleCache', { minutes: 1 });
      // 'callSingle' is guaranteed to run only once even across all threads
      var result = karate.callSingle('classpath:demo/headers/common-noheaders.feature', config);
      // and it sets a variable called 'authInfo' used in headers-single.feature
      config.authInfo = { authTime: result.time, authToken: result.token };
    }
    config.applicationPaths = JSON.parse('[{&quot;contextPath&quot;:&quot;test&quot;},{&quot;contextPath&quot;:&quot;test&quot;}]')
    return config;
  } 
  </code></pre>
  <p>ssl-keystore.feature:</p>
  <pre><code>Feature: jersey ssl with trust store / cert
  
  Background:
      * configure ssl = { keyStore: 'classpath:server-keystore.p12', keyStorePassword: 'karate-mock', keyStoreType: 'pkcs12', trustStore: 'classpath:server-keystore.p12', trustStorePassword: 'karate-mock', trustStoreType: 'pkcs12' }
      * url 'https://localhost:' + karate.properties['jersey.ssl.port']
  
  Scenario Outline:
      Given path '&lt;contextPath&gt;'
      When method get
      Then status 200
      And match response == { success: true }
      Examples:
      | applicationPaths |
  </code></pre>
  <p>If you comment out the configs for the readTimeout and the connectTimeout in the karate-config.js, the test is successful.  With them uncommented, the test fails with a PKIX Path Building Failure.</p>