SpectoLabs / hoverfly-java

Java binding for Hoverfly
Apache License 2.0
168 stars 58 forks source link

Certificate issue in simulating HTTPS Api #282

Closed behappiest closed 1 year ago

behappiest commented 1 year ago

I am simulating HTTPS API using hoverfly-java, when simulating it gives below error Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target This is how I am initiating

 private Hoverfly initHoverfly(HoverflyMode hoverflyMode) {
        LocalHoverflyConfig localHoverflyConfig = localConfigs();
        localHoverflyConfig.disableTlsVerification();
        localHoverflyConfig.proxyPort(hoverflyProxyPort).adminPort(hoverflyAdminPort);
        hoverfly = new Hoverfly(localHoverflyConfig, hoverflyMode);
        hoverfly.setMode(hoverflyMode);
        return hoverfly;
    }

Above code is executing from @BeforeEach

But simulating localhost work.

Steps to reproduce the issue

Observed result

Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target


Hoverfly Version - .0.14.4
behappiest commented 1 year ago

imported hoverfly certificate in cacert solved the issue