-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot make the mockserver proxy works #1811
Comments
From my understanding, mockserver serves as mocking and proxying on the same port, they should be 1080 in your case. |
I am using 5.14.0, it works with proxy and mock. For the latest version, it does NOT, hope can be fixed in new release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the issue
I'm using the docker compose to run mockerserver as proxy (in order to generate the recorded exchanges as expectations later)
However It's not working
here is my docker-compose :
"version: "1.0"
services:
mockServer:
image: mockserver/mockserver:java11
command: -logLevel DEBUG -serverPort 1080 -proxyRemotePort 1070
ports:
- 1080:1080
- 1070:1070
environment:
MOCKSERVER_WATCH_INITIALIZATION_JSON: "true"
MOCKSERVER_INITIALIZATION_JSON_PATH: /config/initializerJson.json
MOCKSERVER_ATTEMPT_TO_PROXY_IF_NO_MATCHING_EXPECTATION: "true"
volumes:
- type: bind
source: .
target: /config
"
What you are trying to do
I'm using the docker compose to run mockerserver as proxy (in order to generate the recorded exchanges as expectations later
MockServer version
5.15.0
To Reproduce
run the docker-compose file
the mockserver is up on the port 1080, and I can check the dashboard, the exectations provided in the initialization mechanism are indded present and can check that they return the desired response with postman (mackserver as mock is working as expected)
now when I configure the proxy 127.0.0.1:1070 in my postman and try to to send some request to an external service, I got :
Error: tunneling socket could not be established, cause=socket hang up in the console of postman, the proxy is not working
when I try rather the config proxy 127.0.0.1:1080, I got Error: tunneling socket could not be established, statusCode=502
MockServer Log
in a use the port 1070 as proxy port, nothing logged, when I use 1080 as proxy port in my postman config I get
" 2023-10-25 06:53:06 5.15.0 SEVERE 1080 Connection failed to localhost/127.0.0.1:1070
server-mockServer-1 | io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:1070
server-mockServer-1 | Caused by: java.net.ConnectException: Connection refused
server-mockServer-1 | at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
server-mockServer-1 | at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:777)
server-mockServer-1 | at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
server-mockServer-1 | at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
server-mockServer-1 | at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
server-mockServer-1 | at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
server-mockServer-1 | at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
server-mockServer-1 | at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
server-mockServer-1 | at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
server-mockServer-1 | at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
server-mockServer-1 | at java.base/java.lang.Thread.run(Thread.java:829)"
The text was updated successfully, but these errors were encountered: