This contains significant rebase / merge / testing work by Naut <lbrynaut@protonmail.com>, Anthony Fieroni <bvbfan@abv.bg> and Brannon King <countprimes@gmail.com>.
Make it possible to reuse sockets. This is necessary to make the RPC tests work in WINE.