diff --git a/autotest/WebSocket/WebSocket.cpp b/autotest/WebSocket/WebSocket.cpp new file mode 100644 index 000000000..a6fa09367 --- /dev/null +++ b/autotest/WebSocket/WebSocket.cpp @@ -0,0 +1,40 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + for(int ssl = 0; ssl < 2; ssl++) + for(int blocking = 0; blocking < 2; blocking++) { + DDUMP(ssl); + DDUMP(blocking); + + WebSocket ws; + + ws.Connect((ssl ? "wss" : "ws") + String("://echo.websocket.org")); + + ws.NonBlocking(!blocking); + + ws.SendText("Test"); + + while(ws.IsOpen()) { + if(ws.IsError()) { + DDUMP(ws.GetError()); + ASSERT(0); + break; + } + String s = ws.Receive(); + if(s.GetCount()) { + DLOG(s); + ASSERT(s == "Test"); + ws.Close(); + } + } + + DLOG("... ok"); + } + + DLOG("============= OK"); +} diff --git a/autotest/WebSocket/WebSocket.upp b/autotest/WebSocket/WebSocket.upp new file mode 100644 index 000000000..044671b4c --- /dev/null +++ b/autotest/WebSocket/WebSocket.upp @@ -0,0 +1,10 @@ +uses + Core, + Core/SSL; + +file + WebSocket.cpp; + +mainconfig + "" = ""; +