[lib] improve handling Tunnelbroker socket state
Summary:
Previously there was an edge case:
- Tunnelbroker socket state is connected: true and isAuthorized: false
- After calling setUnauthorizedDeviceID(false) the state is connected: true and isAuthorized: true, but the connection is still opened using the unauthorized type
- Next, the socket is closed and the state is connected: false and isAuthorized: true
- After the authenticating socket is in state connected: true and isAuthorized: true
As you can see - both 2 and 4 return the same result, but point 2 is not correct. This diff fixes this.
This bug can cause issues described in ENG-8385
Test Plan: Test switching from unauthorized to authorized session
Reviewers: bartek, tomek
Reviewed By: bartek
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D12440