1 4 package com.tc.net.protocol.tcm; 5 6 import com.tc.bytes.TCByteBuffer; 7 import com.tc.exception.ImplementMe; 8 import com.tc.net.TCSocketAddress; 9 import com.tc.net.protocol.NetworkLayer; 10 import com.tc.net.protocol.NetworkStackID; 11 import com.tc.net.protocol.TCNetworkMessage; 12 import com.tc.net.protocol.transport.MessageTransport; 13 import com.tc.util.concurrent.NoExceptionLinkedQueue; 14 15 import java.util.ArrayList ; 16 import java.util.List ; 17 18 public class TestMessageChannel implements MessageChannel { 19 20 public List createMessageContexts = new ArrayList (); 21 public NoExceptionLinkedQueue sendQueue = new NoExceptionLinkedQueue(); 22 public TCMessage message; 23 public ChannelID channelID; 24 25 public void addListener(ChannelEventListener listener) { 26 return; 27 } 28 29 public boolean isConnected() { 30 return false; 31 } 32 33 public boolean isOpen() { 34 return false; 35 } 36 37 public boolean isClosed() { 38 return false; 39 } 40 41 public TCMessage createMessage(TCMessageType type) { 42 createMessageContexts.add(new CreateMessageContext(type, this.message)); 43 return this.message; 44 } 45 46 public void close() { 47 return; 48 } 49 50 public ChannelID getChannelID() { 51 return channelID; 52 } 53 54 public void setSendLayer(NetworkLayer layer) { 55 return; 56 } 57 58 public void setReceiveLayer(NetworkLayer layer) { 59 return; 60 } 61 62 public void send(TCNetworkMessage msg) { 63 sendQueue.put(msg); 64 } 65 66 public void receive(TCByteBuffer[] msgData) { 67 return; 68 } 69 70 public NetworkStackID open() { 71 return null; 72 } 73 74 public void notifyTransportConnected(MessageTransport transport) { 75 return; 76 } 77 78 public void notifyTransportDisconnected(MessageTransport transport) { 79 return; 80 } 81 82 public void notifyTransportConnectAttempt(MessageTransport transport) { 83 return; 84 } 85 86 public void notifyTransportClosed(MessageTransport transport) { 87 return; 88 } 89 90 public Object getAttachment(String key) { 91 throw new ImplementMe(); 92 } 93 94 public void addAttachment(String key, Object value, boolean replace) { 95 throw new ImplementMe(); 96 } 97 98 public Object removeAttachment(String key) { 99 throw new ImplementMe(); 100 } 101 102 public String getRemoteSocketInfo() { 103 throw new ImplementMe(); 104 } 105 106 public TCSocketAddress getLocalAddress() { 107 throw new ImplementMe(); 108 } 109 110 public TCSocketAddress getRemoteAddress() { 111 throw new ImplementMe(); 112 } 113 114 public static class CreateMessageContext { 115 public final TCMessageType type; 116 public final TCMessage returnedMessage; 117 118 private CreateMessageContext(TCMessageType type, TCMessage returnedMessage) { 119 this.type = type; 120 this.returnedMessage = returnedMessage; 121 } 122 } 123 } 124 | Popular Tags |