How to implement handshake in an upstream module?