All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockserver.integration.ClientAndProxy Maven / Gradle / Ivy

There is a newer version: 5.15.0
Show newest version
package org.mockserver.integration;

import org.mockserver.client.proxy.ProxyClient;
import org.mockserver.proxy.http.HttpProxy;
import org.mockserver.proxy.http.HttpProxyBuilder;

/**
 * @author jamesdbloom
 */
public class ClientAndProxy extends ProxyClient {

    private final HttpProxy httpProxy;

    public ClientAndProxy(Integer port) {
        super("localhost", port);
        httpProxy = new HttpProxyBuilder().withHTTPPort(port).build();
    }

    public ClientAndProxy(Integer port, Integer securePort) {
        super("localhost", port);
        httpProxy = new HttpProxyBuilder().withHTTPPort(port).withHTTPSPort(securePort).build();
    }

    public static ClientAndProxy startClientAndProxy(Integer port) {
        return new ClientAndProxy(port);
    }

    public static ClientAndProxy startClientAndProxy(Integer port, Integer securePort) {
        return new ClientAndProxy(port, securePort);
    }

    public boolean isRunning() {
        return httpProxy.isRunning();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy