private static void TestHttp(string host, string url, int port, SPWF04SxConnectionSecurityType security, bool get)
        {
            var buffer = new byte[512];
            var start  = DateTime.UtcNow;
            var code   = get ? wifi.SendHttpGet(host, url, port, security) : wifi.SendHttpPost(host, url, port, security);

            Debug.WriteLine($"HTTP {code}");

            var total = 0;

            while (wifi.ReadHttpResponse(buffer, 0, buffer.Length) is var read && read > 0)
            {
                total += read;

                try {
                    Debugger.Log(0, "", Encoding.UTF8.GetString(buffer, 0, read));
                }
                catch {
                    Debugger.Log(0, "", Encoding.UTF8.GetString(buffer, 0, read - 1));
                }

                Thread.Sleep(100);
            }

            Debug.WriteLine($"\r\nRead: {total:N0} in {(DateTime.UtcNow - start).TotalMilliseconds:N0}ms");
        }
        private static void TestHttp(string host, string url, int port, SPWF04SxConnectionSecurityType security, bool get)
        {
            var    buffer   = new byte[512];
            string resps    = "";
            var    reqjason = $@"{{
                                'message': 'Device Ok: 60',
                                'ioT_Device': 'TINYCLR1',
                                'iotDate': '{DateTime.Now:yyyy-MM-ddTHH:mm:ss}',
                                'sensor1': 59.215686274509807,
                                'sensor2': 22.805429864253391,
                                'sens_power': 0
                            }}";
            var    start    = DateTime.UtcNow;
            int    code     = 0;
            var    total    = 0;

            if (get)
            {
                code = wifi.SendHttpGet(host, url, port, security);
                while (wifi.ReadHttpResponse(buffer, 0, buffer.Length) is var read && read > 0)
                {
                    total += read;

                    try {
                        //Debugger.Log(0, "", Encoding.UTF8.GetString(buffer, 0, read));
                        resps = Encoding.UTF8.GetString(buffer, 0, read);
                    }
                    catch {
                        //Debugger.Log(0, "", Encoding.UTF8.GetString(buffer, 0, read - 1));
                        resps = Encoding.UTF8.GetString(buffer, 0, read - 1);
                    }
                }
            }
            else
            {
                using (HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://" + host + ":" + port + url))
                {
                    var jbuf = Encoding.UTF8.GetBytes(reqjason);
                    httpWebRequest.AllowWriteStreamBuffering = false;
                    httpWebRequest.Method        = "POST";
                    httpWebRequest.ContentType   = "application/json";
                    httpWebRequest.ContentLength = jbuf.Length;

                    Stream sreq = httpWebRequest.GetRequestStream();
                    sreq.Write(jbuf, 0, jbuf.Length);

                    //code = wifi.SendHttpPost(host, url, port, security);
                    //sreq.Flush();
                    var    resp = httpWebRequest.GetResponse();
                    Stream s    = resp.GetResponseStream();
                    using (StreamReader srd = new StreamReader(s))
                    {
                        resps = srd.ReadToEnd();
                    }
                    //resps = Encoding.UTF8.GetString(buffer);
                    //s.Flush();
                    //s.Close();
                    //sreq.Close();
                    //resp.Close();
                };
            }
            Debug.WriteLine($"HTTP {code} - {resps}");
            Debug.WriteLine($"\r\nRead: {total:N0} in {(DateTime.UtcNow - start).TotalMilliseconds:N0}ms");
            Thread.Sleep(1000);
        }