Add a replaceInput() function to Node so disconnecting and connecting a
new input can be an atomic operation.
Also factorize the ConnectCommand