implement handshake prototype

Can you turn this into an error, and pass the `err` from above?