upgradeToSslSocket method

Future<void> upgradeToSslSocket()
inherited

Upgrades the current connection to a secure socket

Implementation

Future<void> upgradeToSslSocket() async {
  _socketStreamSubscription.pause();
  final secureSocket = await SecureSocket.secure(_socket);
  logApp('now using secure connection.');
  await _socketStreamSubscription.cancel();
  isSocketClosingExpected = true;
  _socket.destroy();
  isSocketClosingExpected = false;
  connect(secureSocket);
}