In the code we need to change sleep with thread interruptible sleep (e.g. during resends). May require a thread manager to access the thread.