01: /*
02: * This file is part of the QuickServer library
03: * Copyright (C) 2003-2005 QuickServer.org
04: *
05: * Use, modification, copying and distribution of this software is subject to
06: * the terms and conditions of the GNU Lesser General Public License.
07: * You should have received a copy of the GNU LGP License along with this
08: * library; if not, you can download a copy from <http://www.quickserver.org/>.
09: *
10: * For questions, suggestions, bug-reports, enhancement-requests etc.
11: * visit http://www.quickserver.org
12: *
13: */
14:
15: package test.org.quickserver.net.server;
16:
17: import org.quickserver.net.server.*;
18: import java.io.*;
19: import java.net.*;
20:
21: /**
22: * TestEventHandler for QuickServer
23: */
24: public class TestEventHandler implements ClientEventHandler {
25: private static volatile int gotConnectedFlag;
26: private static volatile int lostConnectionFlag;
27: private static volatile int closingConnectionFlag;
28:
29: public void gotConnected(ClientHandler handler)
30: throws SocketTimeoutException, IOException {
31: gotConnectedFlag++;
32: }
33:
34: public void lostConnection(ClientHandler handler)
35: throws IOException {
36: lostConnectionFlag++;
37: }
38:
39: public void closingConnection(ClientHandler handler)
40: throws IOException {
41: closingConnectionFlag++;
42: }
43:
44: public static int getGotConnectedFlag() {
45: return gotConnectedFlag;
46: }
47:
48: public static int getLostConnectionFlag() {
49: return lostConnectionFlag;
50: }
51:
52: public static int getClosingConnectionFlag() {
53: return closingConnectionFlag;
54: }
55:
56: public static void reset() {
57: gotConnectedFlag = 0;
58: lostConnectionFlag = 0;
59: closingConnectionFlag = 0;
60: }
61: }
|