@Test
public void testLogonIsFirstMessage() throws Exception {

    // set up some basic stuff
    final SessionID sessionID = new SessionID(FixVersions.BEGINSTRING_FIX44, "SENDER", "TARGET");
    final SessionSettings settings = SessionSettingsTest.setUpSession(null);
    setupFileStoreForQFJ357(sessionID, settings);
    // Session gets constructed, triggering a reset
    final UnitTestApplication application = new UnitTestApplication();
    final Session session = setUpFileStoreSession(application, false,
            new UnitTestResponder(), settings, sessionID);
    final SessionState state = getSessionState(session);
    assertEquals(1, state.getNextSenderMsgSeqNum());
    assertEquals(1, state.getNextTargetMsgSeqNum());
    logonTo(session);
    // we should only answer with a Logon message
    assertEquals(1, application.toAdminMessages.size());
    for (Message message : application.toAdminMessages) {
        assertEquals(MsgType.LOGON, message.getHeader().getString(MsgType.FIELD));
    }
    // no reset should have been triggered by QF/J after the Logon attempt
    assertEquals(0, application.sessionResets);
    assertTrue("Session should be connected", session.isLoggedOn());
    assertEquals(2, state.getNextSenderMsgSeqNum());
    assertEquals(2, state.getNextTargetMsgSeqNum());
}