Class ClientAndServer

java.lang.Object
org.mockserver.client.MockServerClient
org.mockserver.integration.ClientAndServer
All Implemented Interfaces:
Closeable, AutoCloseable, org.mockserver.stop.Stoppable

public class ClientAndServer extends org.mockserver.client.MockServerClient
Author:
jamesdbloom
  • Constructor Details

    • ClientAndServer

      public ClientAndServer(Integer... ports)
    • ClientAndServer

      public ClientAndServer(org.mockserver.configuration.Configuration configuration, Integer... ports)
    • ClientAndServer

      public ClientAndServer(String remoteHost, Integer remotePort, Integer... ports)
    • ClientAndServer

      public ClientAndServer(org.mockserver.configuration.Configuration configuration, String remoteHost, Integer remotePort, Integer... ports)
  • Method Details

    • startClientAndServer

      public static ClientAndServer startClientAndServer(List<Integer> ports)
    • startClientAndServer

      public static ClientAndServer startClientAndServer(org.mockserver.configuration.Configuration configuration, List<Integer> ports)
    • startClientAndServer

      public static ClientAndServer startClientAndServer(Integer... port)
    • startClientAndServer

      public static ClientAndServer startClientAndServer(org.mockserver.configuration.Configuration configuration, Integer... port)
    • startClientAndServer

      public static ClientAndServer startClientAndServer(String remoteHost, Integer remotePort, Integer... port)
    • startClientAndServer

      public static ClientAndServer startClientAndServer(org.mockserver.configuration.Configuration configuration, String remoteHost, Integer remotePort, Integer... port)
    • openUI

      public ClientAndServer openUI()
      Launch UI and wait the default period to allow the UI to launch and start collecting logs, this ensures that the log are visible in the UI even if MockServer is shutdown by a test shutdown function, such as After, AfterClass, AfterAll, etc
      Overrides:
      openUI in class org.mockserver.client.MockServerClient
    • openUI

      public ClientAndServer openUI(TimeUnit timeUnit, long pause)
      Launch UI and wait a specified period to allow the UI to launch and start collecting logs, this ensures that the log are visible in the UI even if MockServer is shutdown by a test shutdown function, such as After, AfterClass, AfterAll, etc
      Overrides:
      openUI in class org.mockserver.client.MockServerClient
      Parameters:
      timeUnit - TimeUnit the time unit, for example TimeUnit.SECONDS
      pause - the number of time units to delay before the function returns to ensure the UI is receiving logs
    • isRunning

      public boolean isRunning()
      Overrides:
      isRunning in class org.mockserver.client.MockServerClient
    • hasStarted

      public boolean hasStarted()
      Overrides:
      hasStarted in class org.mockserver.client.MockServerClient
    • stopAsync

      public CompletableFuture stopAsync()
      Overrides:
      stopAsync in class org.mockserver.client.MockServerClient
    • stop

      public void stop()
      Specified by:
      stop in interface org.mockserver.stop.Stoppable
      Overrides:
      stop in class org.mockserver.client.MockServerClient
    • getPort

      public Integer getPort()
      Overrides:
      getPort in class org.mockserver.client.MockServerClient
    • getLocalPort

      public Integer getLocalPort()
    • getLocalPorts

      public List<Integer> getLocalPorts()
    • getRemoteAddress

      public InetSocketAddress getRemoteAddress()
    • registerListener

      public ClientAndServer registerListener(ExpectationsListener expectationsListener)
    • setLogEventListener

      public static void setLogEventListener(Consumer<org.mockserver.log.model.LogEntry> listener)