Refactors state machine contexts into interfaces

This commit is a needed refactoring to make state machines more testable.
 It removes all dependencies from all state machine contexts that before
 had them interconnected and all tangled up, requiring multiple levels
 of mocking. Instead, now they are all implemented by MultiPaxosContext
 which takes care to factor out common needed functionality. While the
 diff is large, it does not represent too big of a change.
Fixes Paxos instance reuse issue

It is possible for a Paxos instance to be started before a previous
 instance has been closed, and to use the same instance Id. A potential
 bug around this is that on receiving phase1Timeout for the second
 instance, the message will be dropped altogether and not retried, as
 the proposer state machine considers the instance closed.
 This commit fixes this issue and introduces a test case for it.
Fixes issue with instances properly changing to PENDING on losing quorum

Instances in TO_SLAVE or TO_MASTER state will remain forever in that state
 if quorum is lost and regained. This commit adds tests for this condition
 and removes an if statement that caused it.
Ensures that ProposerState unbooks retried instances