Add unit tests for KeyManagerImpl This also creates a `TransportKeyManager` interface and a factory for that to be able to test things separately. Closes #205 See merge request !380