/// <summary>
        /// Creates new instance of <see cref="SockClientBase"/> object.
        /// </summary>
        /// <param name="endpointUri">URL for websocket endpoint connection.</param>
        /// <param name="webSocketFactory">Factory class for web socket wrapper creation.</param>
        protected SockClientBase(
            UriBuilder endpointUri,
            IWebSocketFactory webSocketFactory)
        {
            _webSocket = webSocketFactory.CreateWebSocket(endpointUri.Uri);

            _webSocket.Opened += OnOpened;
            _webSocket.Closed += OnClosed;

            _webSocket.MessageReceived += OnMessageReceived;
            _webSocket.DataReceived    += OnDataReceived;

            _webSocket.Error += HandleError;
        }
        /// <summary>
        /// Creates new instance of <see cref="SockClientBase"/> object.
        /// </summary>
        /// <param name="endpointUri">URL for websocket endpoint connection.</param>
        /// <param name="webSocketFactory">Factory class for web socket wrapper creation.</param>
        protected SockClientBase(
            UriBuilder endpointUri,
            IWebSocketFactory webSocketFactory)
        {
            endpointUri = endpointUri ?? throw new ArgumentException(
                                    "Endpoint URL should not be null", nameof(endpointUri));
            webSocketFactory = webSocketFactory ?? throw new ArgumentException(
                                         "Web Socket factory should not be null", nameof(webSocketFactory));

            _webSocket = webSocketFactory.CreateWebSocket(endpointUri.Uri);

            _webSocket.Opened += OnOpened;
            _webSocket.Closed += OnClosed;

            _webSocket.MessageReceived += OnMessageReceived;
            _webSocket.DataReceived    += OnDataReceived;

            _webSocket.Error += HandleError;
        }