private async Task DisconnectInternalAsync()
        {
            if (ConnectionState == ConnectionState.Disconnected)
            {
                return;
            }
            ConnectionState = ConnectionState.Disconnecting;

            try { _connectCancelToken?.Cancel(false); }
            catch { }

            //Wait for tasks to complete
            await _udpRecieveTask.ConfigureAwait(false);

            await _webSocketClient.DisconnectAsync().ConfigureAwait(false);

            ConnectionState = ConnectionState.Disconnected;
        }
        public async Task RunAsync()
        {
            try
            {
                if (await _socketClient.ConnectAsync(_arguments.Port))
                {
                    await SendAsync(new RegisterPluginMessage(_arguments.UUID));

                    await _socketClient.ReceiveAsync();
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                await _socketClient.DisconnectAsync();
            }
        }
        internal override async Task DisconnectInternalAsync()
        {
            if (_webSocketClient == null)
            {
                throw new NotSupportedException("This client is not configured with websocket support.");
            }

            if (ConnectionState == ConnectionState.Disconnected)
            {
                return;
            }
            ConnectionState = ConnectionState.Disconnecting;

            try { _stateCancelToken?.Cancel(false); }
            catch { }

            await _webSocketClient.DisconnectAsync().ConfigureAwait(false);

            ConnectionState = ConnectionState.Disconnected;
        }