KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > net > protocol > transport > MockMessageTransport


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.protocol.transport;
5
6 import com.tc.bytes.TCByteBuffer;
7 import com.tc.exception.ImplementMe;
8 import com.tc.net.TCSocketAddress;
9 import com.tc.net.core.TCConnection;
10 import com.tc.net.protocol.NetworkLayer;
11 import com.tc.net.protocol.NetworkStackID;
12 import com.tc.net.protocol.TCNetworkMessage;
13 import com.tc.util.concurrent.NoExceptionLinkedQueue;
14
15 import java.util.ArrayList JavaDoc;
16 import java.util.List JavaDoc;
17
18 public class MockMessageTransport implements MessageTransport {
19   public ConnectionID connectionId;
20   public NetworkLayer receiveLayer;
21
22   public List JavaDoc listeners = new ArrayList JavaDoc();
23   
24   public ConnectionID getConnectionId() {
25     return this.connectionId;
26   }
27
28   public void addTransportListeners(List JavaDoc toAdd) {
29     listeners.addAll(toAdd);
30   }
31   
32   public void addTransportListener(MessageTransportListener listener) {
33     listeners.add(listener);
34   }
35
36   public void removeTransportListeners() {
37     listeners.clear();
38   }
39   
40   public void setSendLayer(NetworkLayer layer) {
41     throw new ImplementMe();
42   }
43
44   public void setReceiveLayer(NetworkLayer layer) {
45     this.receiveLayer = layer;
46   }
47
48   public void send(TCNetworkMessage message) {
49     throw new ImplementMe();
50   }
51
52   public void receive(TCByteBuffer[] msgData) {
53     throw new ImplementMe();
54   }
55
56   public boolean isConnected() {
57     throw new ImplementMe();
58   }
59
60   public NetworkStackID open() {
61     throw new ImplementMe();
62   }
63
64   public void close() {
65     throw new ImplementMe();
66   }
67
68   public void attachNewConnection(TCConnection connection) {
69     throw new ImplementMe();
70     
71   }
72
73   public void receiveTransportMessage(WireProtocolMessage message) {
74     throw new ImplementMe();
75     
76   }
77
78   public final NoExceptionLinkedQueue sendToConnectionCalls = new NoExceptionLinkedQueue();
79   
80   public void sendToConnection(TCNetworkMessage message) {
81     sendToConnectionCalls.put(message);
82   }
83
84   public TCSocketAddress getRemoteAddress() {
85     throw new ImplementMe();
86   }
87
88   public TCSocketAddress getLocalAddress() {
89     throw new ImplementMe();
90   }
91 }
Popular Tags