Prepare Connection for LibNeubot 3.1

In this branch I cleaned up the Connection patches
prepared by @bassosimone.

Furthermore, I added to Connection some methods to write
random data.

Finally, I also added (and/or cleaned) regression tests.