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.57k stars 1.07k forks source link

Adding Administrative Port or Multiple ports Dynamically #87

Closed arturmkrtchyan closed 9 years ago

arturmkrtchyan commented 9 years ago

Hi @jamesdbloom

Great project! Would you be open for the following contribution ?

Our app is using 10 different services and we want to avoid having 10 different netty instances running. What if I contribute back with the capability of netty binding dynamically to the port requested by the client lib.

or just using administrative port and other ports can be used just for pattern matching ?

Thanks, Artur

arturmkrtchyan commented 9 years ago

Like having one server instance running but using different ports for different services:

mockServerClient('localhost', 1111).mockSimpleResponse('/service1', { 'key': 'Hello World!' }, 200);
mockServerClient('localhost', 2222).mockSimpleResponse('/service2', { 'key': 'Hello World!' }, 200);
mockServerClient('localhost', 3333).mockSimpleResponse('/service3', { 'key': 'Hello World!' }, 200);

Thanks, Artur

jamesdbloom commented 9 years ago

How are you running MockSever? Supporting multiple port bindings is an extension that would be possible to add. However, could you not just mock all the services using a single port. It would be as if all the services had the same port? If you bind the same MockServer instance to multiple ports it will ultimately expose all the same expectations so logically it would behave as if all services where mocked with the same port.

arturmkrtchyan commented 9 years ago

I'm planning to use MockServer for my node.js app. My node app talks to 10+services and they all have different ports. Ideally I can make them all to use the same port and configure it in my mock-config file. Or I can even run multiple instances of MockServer as they are lightweight based on netty.

So in general I don't think that my proposal is going to add big value to the mock-server. Feel free to close it.

jamesbloomnektan commented 9 years ago

As you pointed out it should be light weight and fine to run multiple versions. I'll close this but if you have any issues or more input let me know.