/// <summary>
        /// Sends a webservice to the miniserver and waits until its receives an answer
        /// </summary>
        /// <param name="request">The Request that should be sent</param>
        /// <returns>The Response the miniserver returns</returns>
        public async override Task <WebserviceResponse> SendWebservice(WebserviceRequest request)
        {
            switch (request?.Encryption)
            {
            case EncryptionType.Request:
                request.Command    = Uri.EscapeDataString(Cryptography.AesEncrypt($"salt/{Session.Salt}/{request.Command}", Session));
                request.Command    = $"jdev/sys/enc/{request.Command}";
                request.Encryption = EncryptionType.None;
                return(await SendWebservice(request));

            case EncryptionType.RequestAndResponse:
                string command = Uri.EscapeDataString(Cryptography.AesEncrypt($"salt/{Session.Salt}/{request.Command}", Session));
                command = $"jdev/sys/fenc/{command}";
                WebserviceRequest  encryptedRequest = new WebserviceRequest(command, EncryptionType.None);
                WebserviceResponse encrypedResponse = await SendWebservice(encryptedRequest);

                if (encrypedResponse == null)
                {
                    request.TryValidateResponse(new WebserviceResponse(null, null, (int?)WebSocket?.CloseStatus));
                }
                else
                {
                    request.TryValidateResponse(new WebserviceResponse(encrypedResponse.Header, Encoding.UTF8.GetBytes(Cryptography.AesDecrypt(encrypedResponse.GetAsStringContent(), Session)), (int?)WebSocket?.CloseStatus));
                }
                return(request.WaitForResponse());

            default:
            case EncryptionType.None:
                if (WebSocket == null || WebSocket.State != WebSocketState.Open)
                {
                    return(null);
                }
                lock (Requests) {
                    Requests.Add(request);
                }
                byte[] input = Encoding.UTF8.GetBytes(request.Command);
                await WebSocket.SendAsync(new ArraySegment <byte>(input, 0, input.Length), WebSocketMessageType.Text, true, CancellationToken.None);

                return(request.WaitForResponse());
            }
        }