Package org.mockserver.netty
Class MockServer
java.lang.Object
org.mockserver.lifecycle.LifeCycle
org.mockserver.netty.MockServer
- All Implemented Interfaces:
Closeable,AutoCloseable,org.mockserver.stop.Stoppable
- Author:
- jamesdbloom
-
Field Summary
Fields inherited from class org.mockserver.lifecycle.LifeCycle
bossGroup, httpState, mockServerLogger, serverServerBootstrap, workerGroup -
Constructor Summary
ConstructorsConstructorDescriptionMockServer(Integer... localPorts) Start the instance using the ports providedMockServer(Integer remotePort, String remoteHost, Integer... localPorts) Start the instance using the ports providedMockServer(org.mockserver.configuration.Configuration configuration, Integer... localPorts) Start the instance using the ports providedMockServer(org.mockserver.configuration.Configuration configuration, Integer remotePort, String remoteHost, Integer... localPorts) Start the instance using the ports providedMockServer(org.mockserver.configuration.Configuration configuration, List<org.mockserver.proxyconfiguration.ProxyConfiguration> proxyConfigurations, Integer... localPorts) Start the instance using the ports provided configuring forwarded or proxied requests to go via an additional proxyMockServer(org.mockserver.configuration.Configuration configuration, List<org.mockserver.proxyconfiguration.ProxyConfiguration> proxyConfigurations, String remoteHost, Integer remotePort, Integer... localPorts) Start the instance using the ports provided configuring forwarded or proxied requests to go via an additional proxyMockServer(org.mockserver.configuration.Configuration configuration, org.mockserver.proxyconfiguration.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 proxyMockServer(org.mockserver.proxyconfiguration.ProxyConfiguration proxyConfiguration, Integer... localPorts) Start the instance using the ports provided configuring forwarded or proxied requests to go via an additional proxy -
Method Summary
Modifier and TypeMethodDescriptionintintReturns the current number of active HTTP/3 (QUIC) connections, or 0 if the HTTP/3 server is not running.intReturns the bound HTTP/3 (QUIC) UDP port, or -1 if the HTTP/3 server is not running.registerListener(ExpectationsListener expectationsListener) Methods inherited from class org.mockserver.lifecycle.LifeCycle
bindServerPorts, close, getEventLoopGroup, getLocalPort, getLocalPorts, getPort, getScheduler, isRunning, startedServer, stop
-
Constructor Details
-
MockServer
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
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(org.mockserver.proxyconfiguration.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(org.mockserver.configuration.Configuration configuration, List<org.mockserver.proxyconfiguration.ProxyConfiguration> proxyConfigurations, Integer... localPorts) Start the instance using the ports provided configuring forwarded or proxied requests to go via an additional proxy- Parameters:
proxyConfigurations- 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
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(org.mockserver.configuration.Configuration configuration, 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(org.mockserver.configuration.Configuration configuration, org.mockserver.proxyconfiguration.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
-
MockServer
public MockServer(org.mockserver.configuration.Configuration configuration, List<org.mockserver.proxyconfiguration.ProxyConfiguration> proxyConfigurations, @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 Details
-
getRemoteAddress
-
registerListener
- Overrides:
registerListenerin classLifeCycle
-
getDnsPort
public int getDnsPort() -
getHttp3Port
public int getHttp3Port()Returns the bound HTTP/3 (QUIC) UDP port, or -1 if the HTTP/3 server is not running. -
getHttp3ActiveConnectionCount
public int getHttp3ActiveConnectionCount()Returns the current number of active HTTP/3 (QUIC) connections, or 0 if the HTTP/3 server is not running. -
stopAsync
-