/// <summary>
        /// Disposes the current tunnel.
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            disposed = true;

            Log.Write("Tunnel.Dispose({0})", disposing);

            if (disposing)
            {
                if (handle != null && handle.IsInvalid == false)
                {
                    handle.Dispose();
                }

                owner.Unregister(this);
            }
        }
        /// <summary>
        /// Performs disposal of the NabtoStream and the underlying unmanaged data. Any data not yet sent will be lost.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            disposed = true;

            Log.Write("NabtoClientStream.Dispose({0})", disposing);

            if (disposing)
            {
                if (handle != null && handle.IsInvalid == false)
                {
                    handle.Dispose();
                }

                owner.Unregister(this);
            }

            base.Dispose(disposing);
        }