write binary handshake class and pass tests