diff --git a/upptst/Socket/Socket.cpp b/upptst/Socket/Socket.cpp new file mode 100644 index 000000000..b279786ed --- /dev/null +++ b/upptst/Socket/Socket.cpp @@ -0,0 +1,31 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + TcpSocket socket; + + if(!socket.Connect("pop.gmail.com", 995)) { + LOG("Socket error encountered: " << socket.GetErrorDesc()); + Exit(1); + } + if(!socket.StartSSL()) { + LOG("Couldn't start SSL session."); + Exit(1); + } + + // 5 secs. + socket.Timeout(5000); + + String server_hello = socket.GetLine(); + + DUMP(server_hello); + DUMPHEX(server_hello); + + ASSERT(server_hello.StartsWith("+OK Gpop ready for requests from")); + + LOG("=========== OK"); +} diff --git a/upptst/Socket/Socket.upp b/upptst/Socket/Socket.upp new file mode 100644 index 000000000..046ee3e5f --- /dev/null +++ b/upptst/Socket/Socket.upp @@ -0,0 +1,10 @@ +uses + Core, + Core/SSL; + +file + Socket.cpp; + +mainconfig + "" = "SSE2"; + diff --git a/upptst/Socket/init b/upptst/Socket/init new file mode 100644 index 000000000..21be07a92 --- /dev/null +++ b/upptst/Socket/init @@ -0,0 +1,5 @@ +#ifndef _Socket_icpp_init_stub +#define _Socket_icpp_init_stub +#include "Core/init" +#include "Core/SSL/init" +#endif