[imp] implement handshake