Gets far enough that it needs to do key exchanges.

Based largely on danopia's node.js madness.