1 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 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 38 39 public TCConnection createConnection(TCProtocolAdaptor adaptor) { 40 createConnectionCallCount++; 41 return conn; 42 } 43 44 47 48 public TCConnection createConnection(TCProtocolAdaptor adaptor, TCConnectionEventListener lsnr) { 49 createConnectionCallCount++; 50 return conn; 51 } 52 53 56 57 public TCListener createListener(TCSocketAddress addr, ProtocolAdaptorFactory factory) { 58 return this.listener; 59 } 60 61 64 65 public TCListener createListener(TCSocketAddress addr, ProtocolAdaptorFactory factory, int backlog, boolean reuseAddr) { 66 return this.listener; 67 } 68 69 72 73 public void asynchCloseAllConnections() { 74 throw new ImplementMe(); 75 } 76 77 80 81 public void closeAllListeners() { 82 throw new ImplementMe(); 83 } 84 85 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 |