01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.net.protocol.delivery;
06:
07: import com.tc.async.api.Sink;
08:
09: /**
10: * Creates new instances of OnceAndOnlyOnceProtocolNetworkLayers. This is used so that a mock one may be injected into
11: * the once and only once network stack harness for testing.
12: */
13: public class OnceAndOnlyOnceProtocolNetworkLayerFactoryImpl implements
14: OnceAndOnlyOnceProtocolNetworkLayerFactory {
15:
16: public OnceAndOnlyOnceProtocolNetworkLayer createNewClientInstance(
17: Sink workSink) {
18: OOOProtocolMessageFactory messageFactory = new OOOProtocolMessageFactory();
19: OOOProtocolMessageParser messageParser = new OOOProtocolMessageParser(
20: messageFactory);
21: return new OnceAndOnlyOnceProtocolNetworkLayerImpl(
22: messageFactory, messageParser, workSink, true);
23: }
24:
25: public OnceAndOnlyOnceProtocolNetworkLayer createNewServerInstance(
26: Sink workSink) {
27: OOOProtocolMessageFactory messageFactory = new OOOProtocolMessageFactory();
28: OOOProtocolMessageParser messageParser = new OOOProtocolMessageParser(
29: messageFactory);
30: return new OnceAndOnlyOnceProtocolNetworkLayerImpl(
31: messageFactory, messageParser, workSink, false);
32: }
33:
34: }
|