Package org.mockserver.integration
Class ClientAndServer
- java.lang.Object
-
- org.mockserver.client.MockServerClient
-
- org.mockserver.integration.ClientAndServer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Stoppable
public class ClientAndServer extends MockServerClient
- Author:
- jamesdbloom
-
-
Field Summary
-
Fields inherited from class org.mockserver.client.MockServerClient
portFuture
-
-
Constructor Summary
Constructors Constructor Description ClientAndServer(Integer... ports)
ClientAndServer(String remoteHost, Integer remotePort, Integer... ports)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Integer
getLocalPort()
List<Integer>
getLocalPorts()
Integer
getPort()
Deprecated.use getLocalPort instead of getPortInetSocketAddress
getRemoteAddress()
boolean
hasStarted()
Returns whether MockServer has started, if called after MockServer has been stopped this method will block for 5 seconds while confirming that MockServer is not startingboolean
isRunning()
Returns whether MockServer is running, if called too quickly after starting MockServer this may return false because MockServer has not yet started, to ensure MockServer has started use hasStarted()static ClientAndServer
startClientAndServer(Integer... port)
static ClientAndServer
startClientAndServer(String remoteHost, Integer remotePort, Integer... port)
ClientAndServer
startClientAndServer(List<Integer> ports)
void
stop()
Stop MockServer gracefully (only support for Netty version, not supported for WAR version)-
Methods inherited from class org.mockserver.client.MockServerClient
bind, clear, clear, close, contextPath, hasStarted, hasStopped, hasStopped, isRunning, isSecure, remoteAddress, reset, retrieveActiveExpectations, retrieveActiveExpectations, retrieveLogMessages, retrieveLogMessagesArray, retrieveRecordedExpectations, retrieveRecordedExpectations, retrieveRecordedRequests, retrieveRecordedRequests, retrieveRecordedRequestsAndResponses, retrieveRecordedRequestsAndResponses, sendExpectation, setRequestOverride, stop, stopAsync, verify, verify, verifyZeroInteractions, when, when, when, withSecure
-
-
-
-
Method Detail
-
startClientAndServer
public ClientAndServer startClientAndServer(List<Integer> ports)
-
startClientAndServer
public static ClientAndServer startClientAndServer(Integer... port)
-
startClientAndServer
public static ClientAndServer startClientAndServer(String remoteHost, Integer remotePort, Integer... port)
-
isRunning
public boolean isRunning()
Description copied from class:MockServerClient
Returns whether MockServer is running, if called too quickly after starting MockServer this may return false because MockServer has not yet started, to ensure MockServer has started use hasStarted()- Overrides:
isRunning
in classMockServerClient
-
hasStarted
public boolean hasStarted()
Description copied from class:MockServerClient
Returns whether MockServer has started, if called after MockServer has been stopped this method will block for 5 seconds while confirming that MockServer is not starting- Overrides:
hasStarted
in classMockServerClient
-
stop
public void stop()
Description copied from class:MockServerClient
Stop MockServer gracefully (only support for Netty version, not supported for WAR version)- Specified by:
stop
in interfaceStoppable
- Overrides:
stop
in classMockServerClient
-
getPort
@Deprecated public Integer getPort()
Deprecated.use getLocalPort instead of getPort
-
getLocalPort
public Integer getLocalPort()
-
getRemoteAddress
public InetSocketAddress getRemoteAddress()
-
-