Test refactoring.
Output ports become connected even if there are no connections.

The state should be updated regardless since it is possible to add
connections later. If you need to know if there are any actual
connections, ask for them and count them.
Connect new connections if already connected.
Fix caching bug with connection changes.

Fixes #48.