/// <summary>
        /// Stops receiving the HTTP requests.
        /// </summary>
        public void Stop()
        {
            lock (_sync) {
                var msg = _state.CheckIfStarted();
                if (msg != null)
                {
                    _logger.Error(String.Format("{0}\nstate: {1}", msg, _state));
                    return;
                }

                _state = ServerState.SHUTDOWN;
            }

            _serviceHosts.Stop(new byte [0], true);
            stopListener(5000);

            _state = ServerState.STOP;
        }
        /// <summary>
        /// Broadcasts a binary <paramref name="data"/> to all clients of the WebSocket services
        /// provided by a WebSocket server.
        /// </summary>
        /// <remarks>
        /// This method does not wait for the broadcast to be complete.
        /// </remarks>
        /// <param name="data">
        /// An array of <see cref="byte"/> that contains a binary data to broadcast.
        /// </param>
        /// <param name="completed">
        /// A <see cref="Action"/> delegate that references the method(s) called when
        /// the broadcast is complete.
        /// </param>
        public void Broadcast(byte [] data, Action completed)
        {
            var msg = _state.CheckIfStarted() ?? data.CheckIfValidSendData();

            if (msg != null)
            {
                _logger.Error(msg);
                return;
            }

            if (data.LongLength <= WebSocket.FragmentLength)
            {
                broadcastAsync(Opcode.BINARY, data, completed);
            }
            else
            {
                broadcastAsync(Opcode.BINARY, new MemoryStream(data), completed);
            }
        }