Compared to the previous version, this - Merges execution and verification of scripts. This means we can be more precise in what we actually test - Introduced an explicit data type for "Expected events" which can contain variables (existentials) for connection IDs. This makes it possible to specify the expected event when we open a new connection (we don't know what connection ID will be assigned, so we just create an existential) - Make reordering of events explicit: we introduce a function that creates all permissible reordering of events (that is, events across connections can be reordered, but events within the same connection cannot) We can now run all the tests that don't contain errors without explicit delays, so that unit tests run much faster, and we are testing much more thoroughly: by introducing delays at every step we greatly reduce concurrency; we can now even run test scripts in parallel (but first we need to reintroduce support for scripts with errors).
However, current setup in the mock network implementation is insufficient, because it requires the existence of a socket before we can register an error. That means we can't simulate certain errors (for instance, failure when trying to create the first connection) because we can't hook into the network layer to get the socket at that point.
The following sequence resulted in deadlock: A connects to B A closes connection B connects to A B closes connection B reconnects to A The problem was in the network protocol, where A tells B the ID of the last connection B opened to A. If this is lower than the last connection B *actually* opened, B knows there are still some messages on the way to A and B must wait before they are resolved. However, this connection ID should be kept *per heavyweight connection*. We were inconsistent about this: we recorded the ID of the last created connection on the heavyweight connection, but the next available ID was a 'global' variable on the local endpoint. This meant that B sometimes incorrectly concluded that some messages were still on the way to A, resulting in deadlock.