test: add end-to-end tests for CConnman and PeerManager
Add unit tests that write data to a mocked socket and inspect what CConnman/PeerManager have written back to the socket, or check the internal state to verify that the behavior is as expected.
This is now possible, after most of https://github.com/bitcoin/bitcoin/pull/21878 has been merged - we don't do any syscalls (e.g. connect()
, recv()
) from the high level code and using a mocked socket allows testing the entire networking stack without opening actual network connections.