/// <summary>
 /// Disposes the CustomLogger, releases resources and supresses the finalizer
 /// </summary>
 protected override void OnDispose()
 {
     base.OnDispose();
     if (_client != null)
     {
         _client.Dispose();
         _client = null;
     }
 }
        /// <summary>
        /// Constructs a new SecureStringLogger
        /// </summary>
        /// <param name="serverEndPoint">The IP address for the server</param>
        /// <param name="addTimestamp">If true, the message will be prefixed with a timestamp</param>
        public SecureStringClientLogger(IPEndPoint serverEndPoint, bool addTimestamp = true) : base(serverEndPoint.ToString(), addTimestamp)
        {
            RemoteEndPoint = serverEndPoint;
            _client        = new SecureClient <string>();

            var connected = _client.Socket.ConnectAsync(serverEndPoint.Address, serverEndPoint.Port).Result;

            if (!connected)
            {
                this.SocketError = System.Net.Sockets.SocketError.ConnectionRefused;
                System.Diagnostics.Debug.WriteLine("SecureStringLogger failed to connect to the server.");
                return;
            }
            //if (!_client.WaitForConnected(System.Diagnostics.Debugger.IsAttached ? -1 : 5000))
            //{
            //    this.SocketError = System.Net.Sockets.SocketError.TimedOut;
            //    //throw new TimeoutException("Connection timed out waiting for the server");
            //    return;
            //}
        }