Improved test stability

This commit is contained in:
Jeroen van Erp
2017-08-24 13:59:58 +02:00
parent aa7748395d
commit 0918bc626f
2 changed files with 15 additions and 0 deletions

View File

@@ -137,6 +137,15 @@ public class LocalPortForwarder {
listen(Thread.currentThread());
}
/**
* Returns whether this listener is running (ie. whether a thread is attached to it).
*
* @return
*/
public boolean isRunning() {
return this.runningThread != null && !serverSocket.isClosed();
}
/**
* Start listening for incoming connections and forward to remote host as a channel and ensure that the thread is registered.
* This is useful if for instance {@link #close() is called from another thread}