/// <summary>
        ///   Construct a new RestEndpointStrategy instance.
        /// </summary>
        /// <param name="endpoint">The API endpoint to connect to.</param>
        /// <param name="insecureSSL">Ignore SSL certificate errors.</param>
        /// <param name="authFile">The location of the authentication file. Default: working directory.</param>
        /// <param name="formatter">The formatter to use to format the payloads.</param>
        public RestEndpointStrategy( string endpoint, bool insecureSSL, string authFile, JsonFormatter formatter )
        {
            Log.Info( "Using REST endpoint strategy." );

              PreferredFormatter = formatter;
              InsecureSSL = insecureSSL;

              try {
            AuthInfo = ReadFromAuthFile( authFile );
              } catch( Exception ex ) {
            Log.ErrorFormat( "Problem with authentication file: {0}", ex.Message );
            throw;
              }

              RecievedPayloads = new ConcurrentQueue<string>();

              RetryTimer = new System.Timers.Timer();
              RetryTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
              RetryTimer.Interval = TimeSpan.FromSeconds( 10.0 ).TotalMilliseconds;

              Endpoint = endpoint;
              EndpointUri = new Uri( Endpoint );

              CheckConfiguration();
        }
        public WebsocketStrategy( string ipAddress, JsonFormatter formatter, int port = DefaultPort )
        {
            Log.Info( "Using websocket strategy." );

              Connections = new List<IWebSocketConnection>();

              // Check if a valid port was provided; otherwise use default port instead.
              if( 0 == port ) {
            port = DefaultPort;
              }
              // Check if a valid IP address was provided; otherwise listen on all IP addresses.
              if( null == ipAddress ) {
            ipAddress = "0.0.0.0";
              }

              IpAddress = ipAddress;
              PreferredFormatter = formatter;
              Port = port;

              Fleck.FleckLog.LogAction = ( level, message, ex ) => {
            switch( level ) {
              case LogLevel.Debug:
            Log.Debug( message, ex );
            break;
              case LogLevel.Error:
            Log.Error( message, ex );
            break;
              case LogLevel.Warn:
            Log.Warn( message, ex );
            break;
              default:
            Log.Info( message, ex );
            break;
            }
              };
        }
 public WebsocketSecureStrategy( string ipAddress, JsonFormatter formatter, string certificateFilename, int port = DefaultPort, string certificatePassword = null )
     : base(ipAddress, formatter, port)
 {
     CertificateFilename = certificateFilename;
     CertificatePassword = certificatePassword;
 }