aboutsummaryrefslogtreecommitdiff
path: root/src/tests/itoserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tests/itoserver.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/tests/itoserver.cpp b/src/tests/itoserver.cpp
deleted file mode 100644
index 48ef527..0000000
--- a/src/tests/itoserver.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#include "bu/itoserver.h"
9#include "bu/protocol.h"
10#include "bu/client.h"
11
12#define BU_TRACE
13#include "bu/trace.h"
14
15class ProtocolEcho : public Bu::Protocol
16{
17public:
18 ProtocolEcho()
19 {
20 TRACE();
21 }
22 virtual ~ProtocolEcho()
23 {
24 TRACE();
25 }
26
27 virtual void onNewConnection( Bu::Client * )
28 {
29 TRACE();
30 // Huh...
31 }
32
33 virtual void onNewData( Bu::Client *pClient )
34 {
35 TRACE();
36 char buf[1024];
37 while( pClient->hasInput() )
38 {
39 int iAmnt = pClient->read( buf, 1024 );
40 pClient->write( buf, iAmnt );
41 }
42 }
43};
44
45class TestServer : public Bu::ItoServer
46{
47public:
48 TestServer()
49 {
50 TRACE();
51 }
52 virtual ~TestServer()
53 {
54 TRACE();
55 }
56
57 virtual void onNewConnection( Bu::Client *pClient, int )
58 {
59 TRACE();
60 pClient->setProtocol( new ProtocolEcho() );
61 }
62
63 virtual void onClosedConnection( Bu::Client *pClient )
64 {
65 TRACE();
66 delete pClient->getProtocol();
67 }
68};
69
70int main()
71{
72 TRACE();
73
74 TestServer ts;
75
76 ts.addPort( 5555 );
77 ts.start();
78 ts.join();
79}
80