Fix DTLS setup (involves some test fixes as well)

Every time I see someone add 30+ contiguous lines of code and it's not a new function, I have to ask why.  Why?