Index: core/src/main/java/quickfix/mina/ThreadPerSessionEventHandlingStrategy.java =================================================================== --- core/src/main/java/quickfix/mina/ThreadPerSessionEventHandlingStrategy.java (revision 1052) +++ core/src/main/java/quickfix/mina/ThreadPerSessionEventHandlingStrategy.java (working copy) @@ -43,6 +43,19 @@ private static final long THREAD_WAIT_FOR_MESSAGE_MS = 250; private final ConcurrentMap dispatchers = new ConcurrentHashMap(); + private final SessionConnector sessionConnector; + + public ThreadPerSessionEventHandlingStrategy(SessionConnector connector) { + sessionConnector = connector; + } + + /** + * Internal - To allow unit testing without SessionConnector instance dependency. + */ + ThreadPerSessionEventHandlingStrategy() { + this(null); + } + public void onMessage(Session quickfixSession, Message message) { MessageDispatchingThread dispatcher = dispatchers.get(quickfixSession.getSessionID()); if (dispatcher == null) { @@ -54,11 +67,12 @@ dispatcher.enqueue(message); } - /** There is no such thing as a SesionConnector for thread-per-session handler - we don't multiplex - * between multiple sessions here so this is null + /** The SesionConnector is not directly required for thread-per-session handler - we don't multiplex + * between multiple sessions here. + * However it is made available here for other callers (such as SessionProviders wishing to register dynamic sessions). */ public SessionConnector getSessionConnector() { - return null; + return sessionConnector; } protected void startDispatcherThread(MessageDispatchingThread dispatcher) { Index: core/src/main/java/quickfix/ThreadedSocketInitiator.java =================================================================== --- core/src/main/java/quickfix/ThreadedSocketInitiator.java (revision 1052) +++ core/src/main/java/quickfix/ThreadedSocketInitiator.java (working copy) @@ -27,7 +27,7 @@ * Initiates connections and uses a separate thread per session to process messages. */ public class ThreadedSocketInitiator extends AbstractSocketInitiator { - private final ThreadPerSessionEventHandlingStrategy eventHandlingStrategy = new ThreadPerSessionEventHandlingStrategy(); + private final ThreadPerSessionEventHandlingStrategy eventHandlingStrategy = new ThreadPerSessionEventHandlingStrategy(this); public ThreadedSocketInitiator(Application application, MessageStoreFactory messageStoreFactory, SessionSettings settings, Index: core/src/main/java/quickfix/ThreadedSocketAcceptor.java =================================================================== --- core/src/main/java/quickfix/ThreadedSocketAcceptor.java (revision 1052) +++ core/src/main/java/quickfix/ThreadedSocketAcceptor.java (working copy) @@ -27,7 +27,7 @@ * Accepts connections and uses a separate thread per session to process messages. */ public class ThreadedSocketAcceptor extends AbstractSocketAcceptor { - private final ThreadPerSessionEventHandlingStrategy eventHandlingStrategy = new ThreadPerSessionEventHandlingStrategy(); + private final ThreadPerSessionEventHandlingStrategy eventHandlingStrategy = new ThreadPerSessionEventHandlingStrategy(this); public ThreadedSocketAcceptor(Application application, MessageStoreFactory messageStoreFactory, SessionSettings settings, LogFactory logFactory, MessageFactory messageFactory)