mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@11326 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
8f492ea7ee
commit
e8fa5069ff
2 changed files with 50 additions and 0 deletions
40
autotest/WebSocket/WebSocket.cpp
Normal file
40
autotest/WebSocket/WebSocket.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
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");
|
||||
}
|
||||
10
autotest/WebSocket/WebSocket.upp
Normal file
10
autotest/WebSocket/WebSocket.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
Core,
|
||||
Core/SSL;
|
||||
|
||||
file
|
||||
WebSocket.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue