KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > net > core > MockConnectionManager


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.net.core;
5
6 import com.tc.exception.ImplementMe;
7 import com.tc.net.TCSocketAddress;
8 import com.tc.net.core.event.TCConnectionEventListener;
9 import com.tc.net.protocol.ProtocolAdaptorFactory;
10 import com.tc.net.protocol.TCProtocolAdaptor;
11
12 /**
13  * TODO Jan 4, 2005: comment describing what this class is for.
14  */

15 public class MockConnectionManager implements TCConnectionManager {
16
17   TCConnection conn;
18   
19   TCListener listener;
20   
21   int createConnectionCallCount = 0;
22   
23   public void setConnection(TCConnection conn) {
24     this.conn = conn;
25   }
26   
27   public void setListener(TCListener listener) {
28     this.listener = listener;
29   }
30   
31   public int getCreateConnectionCallCount() {
32     return createConnectionCallCount;
33   }
34   
35   /**
36    *
37    */

38
39   public TCConnection createConnection(TCProtocolAdaptor adaptor) {
40     createConnectionCallCount++;
41     return conn;
42   }
43
44   /**
45    *
46    */

47
48   public TCConnection createConnection(TCProtocolAdaptor adaptor, TCConnectionEventListener lsnr) {
49     createConnectionCallCount++;
50     return conn;
51   }
52
53   /**
54    *
55    */

56
57   public TCListener createListener(TCSocketAddress addr, ProtocolAdaptorFactory factory) {
58     return this.listener;
59   }
60
61   /**
62    *
63    */

64
65   public TCListener createListener(TCSocketAddress addr, ProtocolAdaptorFactory factory, int backlog, boolean reuseAddr) {
66     return this.listener;
67   }
68
69   /**
70    *
71    */

72
73   public void asynchCloseAllConnections() {
74     throw new ImplementMe();
75   }
76
77   /**
78    *
79    */

80
81   public void closeAllListeners() {
82     throw new ImplementMe();
83   }
84
85   /**
86    *
87    */

88
89   public void shutdown() {
90     throw new ImplementMe();
91   }
92
93   public TCConnection[] getAllConnections() {
94     throw new ImplementMe();
95   }
96
97   public TCListener[] getAllListeners() {
98     throw new ImplementMe();
99   }
100
101   public void closeAllConnections(long timeout) {
102     throw new ImplementMe();
103     
104   }
105
106 }
107
Popular Tags