setSocket method
Set inner socket for this channel
Implementation
Future<void> setSocket(C? sock) async {
// 1. replace with new socket
C? old = _sock;
if (sock != null) {
_sock = sock;
_closed = false;
} else {
_sock = null;
_closed = true;
}
// 2. close old socket
if (old == null || identical(old, sock)) {} else {
await SocketHelper.socketDisconnect(old);
}
}