Skip to content

Commit 657a78f

Browse files
committed
Allow changing the connect timeout after the proxy has been started
1 parent 299291a commit 657a78f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

browsermob-core-littleproxy/src/main/java/net/lightbody/bmp/BrowserMobProxyServer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,11 +892,11 @@ public void setWriteLimitKbps(long writeLimitKbps) {
892892

893893
@Override
894894
public void setConnectTimeout(int connectTimeout, TimeUnit timeUnit) {
895+
this.connectTimeoutMs = (int) TimeUnit.MILLISECONDS.convert(connectTimeout, timeUnit);
896+
895897
if (isStarted()) {
896-
throw new IllegalStateException("LittleProxy implementation does not allow changes to connect timeout after proxy has been started");
898+
proxyServer.setConnectTimeout((int) TimeUnit.MILLISECONDS.convert(connectTimeout, timeUnit));
897899
}
898-
899-
this.connectTimeoutMs = (int) TimeUnit.MILLISECONDS.convert(connectTimeout, timeUnit);
900900
}
901901

902902
/**

0 commit comments

Comments
 (0)