Package org.mockserver.mockserver
Class MockServer
- java.lang.Object
-
- org.mockserver.lifecycle.LifeCycle
-
- org.mockserver.mockserver.MockServer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Stoppable
public class MockServer extends LifeCycle
- Author:
- jamesdbloom
-
-
Field Summary
-
Fields inherited from class org.mockserver.lifecycle.LifeCycle
bossGroup, httpStateHandler, mockServerLogger, serverServerBootstrap, workerGroup
-
-
Constructor Summary
Constructors Constructor Description MockServer(Integer... localPorts)
Start the instance using the ports providedMockServer(Integer remotePort, String remoteHost, Integer... localPorts)
Start the instance using the ports providedMockServer(ProxyConfiguration proxyConfiguration, Integer... localPorts)
Start the instance using the ports provided configuring forwarded or proxied requests to go via an additional proxyMockServer(ProxyConfiguration proxyConfiguration, String remoteHost, Integer remotePort, Integer... localPorts)
Start the instance using the ports provided configuring forwarded or proxied requests to go via an additional proxy
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InetSocketAddress
getRemoteAddress()
-
Methods inherited from class org.mockserver.lifecycle.LifeCycle
bindServerPorts, close, getEventLoopGroup, getLocalPort, getLocalPorts, getPort, getScheduler, isRunning, startedServer, stop
-
-
-
-
Constructor Detail
-
MockServer
public MockServer(Integer... localPorts)
Start the instance using the ports provided- Parameters:
localPorts
- the local port(s) to use, use 0 or no vararg values to specify any free port
-
MockServer
public MockServer(ProxyConfiguration proxyConfiguration, Integer... localPorts)
Start the instance using the ports provided configuring forwarded or proxied requests to go via an additional proxy- Parameters:
proxyConfiguration
- the proxy configuration to send requests forwarded or proxied by MockServer via another proxylocalPorts
- the local port(s) to use, use 0 or no vararg values to specify any free port
-
MockServer
public MockServer(Integer remotePort, @Nullable String remoteHost, Integer... localPorts)
Start the instance using the ports provided- Parameters:
remotePort
- the port of the remote server to connect toremoteHost
- the hostname of the remote server to connect to (if null defaults to "localhost")localPorts
- the local port(s) to use
-
MockServer
public MockServer(ProxyConfiguration proxyConfiguration, @Nullable String remoteHost, Integer remotePort, Integer... localPorts)
Start the instance using the ports provided configuring forwarded or proxied requests to go via an additional proxy- Parameters:
localPorts
- the local port(s) to useremoteHost
- the hostname of the remote server to connect to (if null defaults to "localhost")remotePort
- the port of the remote server to connect to
-
-
Method Detail
-
getRemoteAddress
public InetSocketAddress getRemoteAddress()
-
-