implement handshake prototype

Don't you want to reverse this?