Skip to content

Commit 87c5851

Browse files
committed
Add constructor for proxy on specific port
Create a proxy on a specific port rather than just increment the count
1 parent cceba2e commit 87c5851

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/org/browsermob/proxy/ProxyManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ public ProxyManager(Provider<ProxyServer> proxyServerProvider) {
2020
this.proxyServerProvider = proxyServerProvider;
2121
}
2222

23+
public ProxyServer create(Map<String, String> options, int port) throws Exception {
24+
ProxyServer proxy = proxyServerProvider.get();
25+
proxy.setPort(port);
26+
proxy.start();
27+
proxy.setOptions(options);
28+
proxies.put(port, proxy);
29+
return proxy;
30+
}
31+
2332
public ProxyServer create(Map<String, String> options) throws Exception {
2433
int port = portCounter.incrementAndGet();
2534
ProxyServer proxy = proxyServerProvider.get();

0 commit comments

Comments
 (0)