Skip to content

Commit

Permalink
properly stop Selenide proxy server
Browse files Browse the repository at this point in the history
* method proxy.stop() waits for network traffic to stop (up to 5 seconds), while
* method proxy.abort() doesn't wait for anything, causing proxy-related errors in logs
  • Loading branch information
asolntsev committed Aug 13, 2022
1 parent 7ec42a7 commit b89ff38
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private Proxy createSeleniumProxy() {
public void shutdown() {
if (proxy.isStarted()) {
try {
proxy.abort();
proxy.stop();
}
catch (IllegalStateException ignore) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void canChainProxyServersWithEmptyNoProxySettings() {
void canShutdownProxyServer() {
when(bmp.isStarted()).thenReturn(true);
proxyServer.shutdown();
verify(bmp).abort();
verify(bmp).stop();
}

@Test
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/integration/server/LocalHttpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public LocalHttpServer start() throws Exception {
return this;
}

public void stop() throws Exception {
server.stop();
}

public static LocalHttpServer startWithRetry(boolean ssl) throws Exception {
IOException lastError = null;
for (int i = 0; i < 5; i++) {
Expand Down

0 comments on commit b89ff38

Please sign in to comment.