ISPN-2574 Segment transfer not restarted if the owner fails

* The already in-progress inbound task that was fetching from a leaver should have been cancelled before being retried. The existing code already took care of removing the old task and creating a new one but it should have also removed it from taskQueue and interrupt the task in order to unblock the transfer thread. InbounTransferTask.terminate() method was added for this.

* The logic that prevents two transfer threads running at the same time is broken and could also result in no thread runnintg at all if the existing thread was about to exit but did not set isTransferThreadRunning to false yet. This means not all tasks in taskQueue were always processed.

* Add StateTransferRestartTest that highlights the above issues, contributed by Michal Linhard.