Skip to content

Commit

Permalink
Make sure that ReverseProxy is started at the end of start method.
Browse files Browse the repository at this point in the history
This should fix some instability in test using that class.
  • Loading branch information
sbernard31 committed Jul 17, 2023
1 parent b57049a commit 42bda55
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ public void start() {
logAndRaiseException("Unexpected IO Exception when running proxy", e);
}
});

// Wait until proxy is really running
for (int i = 0; i < 10 && running; i++) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
LOGGER.debug("Start was interrupted", e);
}
}
if (!running) {
LOGGER.error("Unable to start ReverseProxy");
}
}

private void handleClientPackets() throws IOException {
Expand Down Expand Up @@ -234,7 +246,7 @@ public void changeServerSideProxyAddress() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.debug("Change Server Side Proxy Address was interrupted", e);
}
}
}
Expand Down

0 comments on commit 42bda55

Please sign in to comment.