startSSL method

Future<void> startSSL()

Implementation

Future<void> startSSL() async {
  var socket = await RawSecureSocket.secure(_socket,
      subscription: _subscription as StreamSubscription<RawSocketEvent>?, onBadCertificate: (cert) => true);
  _socket = socket;
  _socket.setOption(SocketOption.tcpNoDelay, true);
  _subscription = _socket.listen(_onData, onError: _onSocketError, onDone: _onSocketDone, cancelOnError: true);
  _socket.writeEventsEnabled = true;
  _socket.readEventsEnabled = true;
}