Change the pattern matching of authentication callback result to allow
to push more extra states.
Update example use authentication callback to close connection
automatically.