public override void Stash()
 {
     base.Stash();
     this.cipher?.Dispose();
     this.cipher = null;
     this.dh     = null;
 }
        protected override void OnConnectionClosed(ConnectionClosedEventArgs args)
        {
            this.cipher?.Dispose();
            this.cipher = null;
            this.dh     = null;

            base.OnConnectionClosed(args);
        }
 internal RpcUdpConnectionEncrypted(UdpPeer parent, ICipher cipher, IRpcPeer rpcPeer, RpcConfiguration configuration) : base(parent, rpcPeer, configuration)
 {
     if (cipher == null)
     {
         throw new ArgumentNullException(nameof(cipher));
     }
     this.cipher = cipher;
     this.dh     = new DiffieHellmanImpl(cipher);
 }
 internal void SetCipher(ICipher cipher)
 {
     this.cipher = cipher;
     this.dh     = new DiffieHellmanImpl(cipher);
 }