@Test public void shouldResendConnectToSameEngineWhenConnectionTimesOut() { setupAndConnectToFirstChannel(); pollTwice(); clock.advanceMilliSeconds(CONNECT_ATTEMPT_TIMEOUT + 1); poll(); sendsLibraryConnect(times(1)); doesNotAttemptConnectTo(LEADER_CHANNEL); }
int poll(final int fragmentLimit) { final long timeInMs = timeInMs(); switch (state) { case CONNECTED: return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CONNECT: startConnecting(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CONNECTING: nextConnectingStep(timeInMs); return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CURRENT_NODE: connectToNewEngine(timeInMs); state = CONNECTING; return pollWithoutReconnect(timeInMs, fragmentLimit); case ENGINE_DISCONNECT: attemptEngineCloseBasedLogout(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CLOSED: default: return 0; } }
LibraryPoller implements LibraryEndPointHandler, ProtocolHandler, AutoCloseable { int poll(final int fragmentLimit) { final long timeInMs = timeInMs(); switch (state) { case CONNECTED: return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CONNECT: startConnecting(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CONNECTING: nextConnectingStep(timeInMs); return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CURRENT_NODE: connectToNewEngine(timeInMs); state = CONNECTING; return pollWithoutReconnect(timeInMs, fragmentLimit); case ENGINE_DISCONNECT: attemptEngineCloseBasedLogout(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CLOSED: default: return 0; } } }
LibraryPoller implements LibraryEndPointHandler, ProtocolHandler, AutoCloseable { int poll(final int fragmentLimit) { final long timeInMs = timeInMs(); switch (state) { case CONNECTED: return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CONNECT: startConnecting(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CONNECTING: nextConnectingStep(timeInMs); return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CURRENT_NODE: connectToNewEngine(timeInMs); state = CONNECTING; return pollWithoutReconnect(timeInMs, fragmentLimit); case ENGINE_DISCONNECT: attemptEngineCloseBasedLogout(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CLOSED: default: return 0; } } LibraryPoller(
        final LibraryConfiguration configuration,
        final LibraryTimers timers,
        final FixCounters fixCounters,
        final LibraryTransport transport,
        final FixLibrary fixLibrary,
        final EpochClock epochClock); }
LibraryPoller implements LibraryEndPointHandler, ProtocolHandler, AutoCloseable { int poll(final int fragmentLimit) { final long timeInMs = timeInMs(); switch (state) { case CONNECTED: return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CONNECT: startConnecting(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CONNECTING: nextConnectingStep(timeInMs); return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CURRENT_NODE: connectToNewEngine(timeInMs); state = CONNECTING; return pollWithoutReconnect(timeInMs, fragmentLimit); case ENGINE_DISCONNECT: attemptEngineCloseBasedLogout(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CLOSED: default: return 0; } } LibraryPoller(
        final LibraryConfiguration configuration,
        final LibraryTimers timers,
        final FixCounters fixCounters,
        final LibraryTransport transport,
        final FixLibrary fixLibrary,
        final EpochClock epochClock); Reply<ILink3Connection> initiate(final ILink3ConnectionConfiguration configuration); void readMetaData(final long sessionId, final MetadataHandler handler); Action onManageSession(
        final int libraryId,
        final long connectionId,
        final long sessionId,
        final int lastSentSeqNum,
        final int lastRecvSeqNum,
        final SessionStatus sessionStatus,
        final SlowStatus slowStatus,
        final ConnectionType connectionType,
        final SessionState sessionState,
        final int heartbeatIntervalInS,
        final boolean closedResendInterval,
        final int resendRequestChunkSize,
        final boolean sendRedundantResendRequests,
        final boolean enableLastMsgSeqNumProcessed,
        final long correlationId,
        final int sequenceIndex,
        final boolean awaitingResend,
        final int lastResentMsgSeqNo,
        final int lastResendChunkMsgSeqNum,
        final int endOfResendRequestRange,
        final boolean awaitingHeartbeat,
        final int logonReceivedSequenceNumber,
        final int logonSequenceIndex,
        final long lastLogonTime,
        final long lastSequenceResetTime,
        final String localCompId,
        final String localSubId,
        final String localLocationId,
        final String remoteCompId,
        final String remoteSubId,
        final String remoteLocationId,
        final String address,
        final String username,
        final String password,
        final Class<? extends FixDictionary> fixDictionaryType,
        final MetaDataStatus metaDataStatus,
        final DirectBuffer metaDataBuffer,
        final int metaDataOffset,
        final int metaDataLength); Action onMessage(
        final DirectBuffer buffer,
        final int offset,
        final int length,
        final int libraryId,
        final long connectionId,
        final long sessionId,
        final int sequenceIndex,
        final long messageType,
        final long timestamp,
        final MessageStatus status,
        final int sequenceNumber,
        final long position,
        final int metaDataLength); Action onDisconnect(
        final int libraryId, final long connectionId, final DisconnectReason reason); Action onILinkMessage(final long connectionId, final DirectBuffer buffer, final int offset); Action onError(
        final int libraryId,
        final GatewayError errorType,
        final long replyToId,
        final String message); Action onApplicationHeartbeat(final int libraryId); Action onReleaseSessionReply(final int libraryId, final long replyToId, final SessionReplyStatus status); Action onRequestSessionReply(final int libraryId, final long replyToId, final SessionReplyStatus status); Action onFollowerSessionReply(final int libraryId, final long replyToId, final long sessionId); Action onReplayMessagesReply(final int libraryId, final long replyToId, final ReplayMessagesStatus status); Action onWriteMetaDataReply(final int libraryId, final long replyToId, final MetaDataStatus status); Action onILinkConnect(
        final int libraryId,
        final long correlationId,
        final long connectionId,
        final long uuid,
        final long lastReceivedSequenceNumber,
        final long lastSentSequenceNumber,
        final boolean newlyAllocated,
        final long lastUuid); Action onReadMetaDataReply(
        final int libraryId,
        final long replyToId,
        final MetaDataStatus status,
        final DirectBuffer srcBuffer,
        final int srcOffset,
        final int srcLength); Action onEngineClose(final int libraryId); Action onControlNotification(
        final int libraryId,
        final InitialAcceptedSessionOwner initialAcceptedSessionOwner,
        final SessionsDecoder sessionsDecoder); Action onLibraryExtendPosition(
        final int libraryId,
        final long correlationId,
        final int newSessionId,
        final long stopPosition,
        final int initialTermId,
        final int termBufferLength,
        final int mtuLength); Action onSlowStatusNotification(
        final int libraryId, final long connectionId, final boolean hasBecomeSlow); Action onResetLibrarySequenceNumber(final int libraryId, final long sessionId); Action onReplayComplete(final int libraryId, final long connection); void close(); long saveInitiateILink(final long correlationId, final ILink3ConnectionConfiguration configuration); List<ILink3Connection> iLink3Sessions(); void remove(final ILink3Connection session); }
LibraryPoller implements LibraryEndPointHandler, ProtocolHandler, AutoCloseable { int poll(final int fragmentLimit) { final long timeInMs = timeInMs(); switch (state) { case CONNECTED: return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CONNECT: startConnecting(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CONNECTING: nextConnectingStep(timeInMs); return pollWithoutReconnect(timeInMs, fragmentLimit); case ATTEMPT_CURRENT_NODE: connectToNewEngine(timeInMs); state = CONNECTING; return pollWithoutReconnect(timeInMs, fragmentLimit); case ENGINE_DISCONNECT: attemptEngineCloseBasedLogout(); return pollWithoutReconnect(timeInMs, fragmentLimit); case CLOSED: default: return 0; } } LibraryPoller(
        final LibraryConfiguration configuration,
        final LibraryTimers timers,
        final FixCounters fixCounters,
        final LibraryTransport transport,
        final FixLibrary fixLibrary,
        final EpochClock epochClock); Reply<ILink3Connection> initiate(final ILink3ConnectionConfiguration configuration); void readMetaData(final long sessionId, final MetadataHandler handler); Action onManageSession(
        final int libraryId,
        final long connectionId,
        final long sessionId,
        final int lastSentSeqNum,
        final int lastRecvSeqNum,
        final SessionStatus sessionStatus,
        final SlowStatus slowStatus,
        final ConnectionType connectionType,
        final SessionState sessionState,
        final int heartbeatIntervalInS,
        final boolean closedResendInterval,
        final int resendRequestChunkSize,
        final boolean sendRedundantResendRequests,
        final boolean enableLastMsgSeqNumProcessed,
        final long correlationId,
        final int sequenceIndex,
        final boolean awaitingResend,
        final int lastResentMsgSeqNo,
        final int lastResendChunkMsgSeqNum,
        final int endOfResendRequestRange,
        final boolean awaitingHeartbeat,
        final int logonReceivedSequenceNumber,
        final int logonSequenceIndex,
        final long lastLogonTime,
        final long lastSequenceResetTime,
        final String localCompId,
        final String localSubId,
        final String localLocationId,
        final String remoteCompId,
        final String remoteSubId,
        final String remoteLocationId,
        final String address,
        final String username,
        final String password,
        final Class<? extends FixDictionary> fixDictionaryType,
        final MetaDataStatus metaDataStatus,
        final DirectBuffer metaDataBuffer,
        final int metaDataOffset,
        final int metaDataLength); Action onMessage(
        final DirectBuffer buffer,
        final int offset,
        final int length,
        final int libraryId,
        final long connectionId,
        final long sessionId,
        final int sequenceIndex,
        final long messageType,
        final long timestamp,
        final MessageStatus status,
        final int sequenceNumber,
        final long position,
        final int metaDataLength); Action onDisconnect(
        final int libraryId, final long connectionId, final DisconnectReason reason); Action onILinkMessage(final long connectionId, final DirectBuffer buffer, final int offset); Action onError(
        final int libraryId,
        final GatewayError errorType,
        final long replyToId,
        final String message); Action onApplicationHeartbeat(final int libraryId); Action onReleaseSessionReply(final int libraryId, final long replyToId, final SessionReplyStatus status); Action onRequestSessionReply(final int libraryId, final long replyToId, final SessionReplyStatus status); Action onFollowerSessionReply(final int libraryId, final long replyToId, final long sessionId); Action onReplayMessagesReply(final int libraryId, final long replyToId, final ReplayMessagesStatus status); Action onWriteMetaDataReply(final int libraryId, final long replyToId, final MetaDataStatus status); Action onILinkConnect(
        final int libraryId,
        final long correlationId,
        final long connectionId,
        final long uuid,
        final long lastReceivedSequenceNumber,
        final long lastSentSequenceNumber,
        final boolean newlyAllocated,
        final long lastUuid); Action onReadMetaDataReply(
        final int libraryId,
        final long replyToId,
        final MetaDataStatus status,
        final DirectBuffer srcBuffer,
        final int srcOffset,
        final int srcLength); Action onEngineClose(final int libraryId); Action onControlNotification(
        final int libraryId,
        final InitialAcceptedSessionOwner initialAcceptedSessionOwner,
        final SessionsDecoder sessionsDecoder); Action onLibraryExtendPosition(
        final int libraryId,
        final long correlationId,
        final int newSessionId,
        final long stopPosition,
        final int initialTermId,
        final int termBufferLength,
        final int mtuLength); Action onSlowStatusNotification(
        final int libraryId, final long connectionId, final boolean hasBecomeSlow); Action onResetLibrarySequenceNumber(final int libraryId, final long sessionId); Action onReplayComplete(final int libraryId, final long connection); void close(); long saveInitiateILink(final long correlationId, final ILink3ConnectionConfiguration configuration); List<ILink3Connection> iLink3Sessions(); void remove(final ILink3Connection session);  }