Close and re-open connection when there is an error

hi, when there is a token corrupt Apple tell to close connection and reopen.