Implemented (pseudo)connection by means of exchanging Ping packets

And added a test for it.
Node now detects disconnection

When it doesn't receive a packet for a period of time.
Minor refactoring of tests