Fix installation of plugins

e51c428fe5ef3960f4990e1c0471d067783d4718 broke the unregistering of plugin
owned SSH command by passing wrong instance to the ConcurrentMap.remove()
function.

bae9e58ddd68992473307787fb01e022f5969fee was trying to fix it, but broke it
for the installation of plugins by throwing the `IllegalStateException` in case
the old registration handle wasn't found. But it's perfectly possible and even
wanted during plugin reloading: registration handle is replaced and the old one
cannot be found.

Moreover, bae9e58ddd68992473307787fb01e022f5969fee didn't fix all places:
the same bug in unregistering of SSH commands in
DispatchCommandProvider.replace() method wasn't fixed.

Change-Id: I21132d4f7aec58347acbf50d75a962cb8251201f
1 file changed