Tidy up locking in OpenSSLSocketImpl.
Tidy up locking in OpenSSLSocketImpl.

We guard all state with a single lock "stateLock", which
replaces usages of "this" and "handshakeLock". We do not
perform any blocking operations while holding this lock.
In particular, startHandshake is no longer synchronized.

We use a single integer to keep track of handshake state
instead of a pair of booleans.

Also fix a bug in getSession, the previous implementation
wouldn't work in cut-through mode.

This fixes a deadlock in SSLSocketTest_interrupt.

Change-Id: I9aef991e0579d4094e287dde8e521d09d6468c51

google/conscrypt,google/conscrypt,google/conscrypt,google/conscrypt,google/conscrypt,google/conscrypt