@Test
public void testFIXTLogonAndApplVerID() throws Exception {

    EventHandlingStrategy mockEventHandlingStrategy = mock(EventHandlingStrategy.class);
    IoSession mockIoSession = mock(IoSession.class);
    final SessionID sessionID = new SessionID(FixVersions.BEGINSTRING_FIXT11, "SENDER",
            "TARGET");
    try (Session session = SessionFactoryTestSupport.createSession(sessionID,
            new UnitTestApplication(), false)) {
        stub(mockIoSession.getAttribute("QF_SESSION")).toReturn(null); // to create a new Session
        final HashMap<SessionID, Session> acceptorSessions = new HashMap<>();
        acceptorSessions.put(sessionID, session);
        final StaticAcceptorSessionProvider sessionProvider = createSessionProvider(acceptorSessions);
        final AcceptorIoHandler handler = new AcceptorIoHandler(sessionProvider,
                new NetworkingOptions(new Properties()), mockEventHandlingStrategy);
        final DefaultApplVerID defaultApplVerID = new DefaultApplVerID(ApplVerID.FIX50SP2);
        final Logon message = new Logon(new EncryptMethod(EncryptMethod.NONE_OTHER),
                new HeartBtInt(30), defaultApplVerID);
        message.getHeader().setString(TargetCompID.FIELD, sessionID.getSenderCompID());
        message.getHeader().setString(SenderCompID.FIELD, sessionID.getTargetCompID());
        message.getHeader().setField(new SendingTime(LocalDateTime.now()));
        message.getHeader().setInt(MsgSeqNum.FIELD, 1);
        handler.processMessage(mockIoSession, message);
        assertEquals(defaultApplVerID.getValue(), session.getTargetDefaultApplicationVersionID()
                .getValue());
    }
}