mock-server / mockserver

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
http://mock-server.com
Apache License 2.0
4.62k stars 1.08k forks source link

Create expectations over HTTPS #1900

Open kriodoxis opened 3 months ago

kriodoxis commented 3 months ago

Describe the feature request Create expectations over HTTPS

What you are trying to do After succesfully running Mockserver, I need to create expectations over HTTPS, I´ve tried to create a client with the following code:

new MockServerClient("tests.io", 443, "/test-mockserver")

But I receive the response:

Exception in thread "main" java.lang.IllegalArgumentException: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
</body>
</html>

    at org.mockserver.client.MockServerClient.sendRequest(MockServerClient.java:402)

As my server resides in a Cloud environment where it can only accept HTTPS traffic

The solution you'd like When creating the Mockserver Client, add a flag to indicate to accept secure connections

Describe alternatives you've considered I´ve tried enabling TLS but haven´t found a clear example.