DHT and Socket Refactoring

Do not destroy context if socket test fails
This has too many arguments to be readable as a `lambda`. I suggest using `findKeyValue` but I won't press it.