1 4 package com.tc.net.protocol; 5 6 import EDU.oswego.cs.dl.util.concurrent.LinkedQueue; 7 8 import com.tc.exception.ImplementMe; 9 import com.tc.net.core.TCConnection; 10 import com.tc.net.protocol.transport.ConnectionID; 11 import com.tc.net.protocol.transport.MessageTransport; 12 import com.tc.net.protocol.transport.NetworkStackProvider; 13 14 public class MockNetworkStackProvider implements NetworkStackProvider { 15 16 private final LinkedQueue connectTransportCalls = new LinkedQueue(); 17 18 public boolean throwStackNotFoundException = false; 19 20 public void attachNewConnection(TCConnection connection) throws StackNotFoundException { 21 try { 22 connectTransportCalls.put(connection); 23 if (throwStackNotFoundException) { 24 throw new StackNotFoundException(null); 25 } 26 } catch (InterruptedException e) { 27 e.printStackTrace(); 28 } 29 } 30 31 public MessageTransport waitForConnectTransportCall(long timeout) throws InterruptedException { 32 return (MessageTransport) connectTransportCalls.poll(timeout); 33 } 34 35 public NetworkStackHarness removeNetworkStack(ConnectionID connectionId) { 36 throw new ImplementMe(); 37 } 38 39 public MessageTransport attachNewConnection(ConnectionID connectionId, TCConnection connection) { 40 throw new ImplementMe(); 41 } 42 43 } | Popular Tags |