unit tests for witness plugin using previously introduced features that enable it
Also a small change that makes "unit test way" of closing application almost the same as "normal way". It required adding check on interrupt in witness loop. It is because in "normal way" all the closing happens from signal handler thread, which blocks witness loop until all is closed. It also guarantees that witness loop is not active when related task is cleared. However in "unit test way" closing happens from whatever thread called the close, which in most cases means the witness loop is going to activate mid-way of closing, which in turn leads to reading of just closed state.
Edited by Andrzej Lisak