package org.mockserver;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.mockserver.client.proxy.ProxyClient;
import org.mockserver.integration.proxy.AbstractClientProxyIntegrationTest;
import org.mockserver.integration.testserver.TestServer;
import org.mockserver.socket.PortFactory;
/**
* @author jamesdbloom
*/
public class ClientProxyMavenPluginTest extends AbstractClientProxyIntegrationTest {
private final static int SERVER_HTTP_PORT = PortFactory.findFreePort();
private final static int SERVER_HTTPS_PORT = PortFactory.findFreePort();
private final static int PROXY_HTTP_PORT = 9092;
private final static int PROXY_HTTPS_PORT = 9093;
private static TestServer testServer = new TestServer();
private static ProxyClient proxyClient;
@BeforeClass
public static void startServer() throws Exception {
testServer.startServer(SERVER_HTTP_PORT, SERVER_HTTPS_PORT);
// start client
proxyClient = new ProxyClient("localhost", PROXY_HTTP_PORT);
}
@AfterClass
public static void stopServer() throws Exception {
testServer.stop();
}
@Before
public void resetProxy() {
proxyClient.reset();
}
@Override
public int getProxyPort() {
return PROXY_HTTP_PORT;
}
@Override
public int getServerPort() {
return SERVER_HTTP_PORT;
}
@Override
public int getServerSecurePort() {
return SERVER_HTTPS_PORT;
}
}