@Test public void nextSequence() throws StreamConnectionClosedException { assertThat(streamConnection.nextSequence()).isEqualTo(UnsignedLong.ONE); assertThat(streamConnection.nextSequence()).isEqualTo(UnsignedLong.valueOf(2L)); assertThat(streamConnection.nextSequence()).isEqualTo(UnsignedLong.valueOf(3L)); assertThat(streamConnection.nextSequence()).isEqualTo(UnsignedLong.valueOf(4L)); }
public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { this.closeConnection(); throw new StreamConnectionClosedException(streamConnectionId); } }
StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { this.closeConnection(); throw new StreamConnectionClosedException(streamConnectionId); } } }
StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { this.closeConnection(); throw new StreamConnectionClosedException(streamConnectionId); } } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret);  StreamConnection(final StreamConnectionId streamConnectionId); }
StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { this.closeConnection(); throw new StreamConnectionClosedException(streamConnectionId); } } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret);  StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCreationDateTime(); void transitionConnectionState(); StreamConnectionState getConnectionState(); StreamConnectionId getStreamConnectionId(); void closeConnection(); boolean isClosed(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override void close(); }
StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { this.closeConnection(); throw new StreamConnectionClosedException(streamConnectionId); } } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret);  StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCreationDateTime(); void transitionConnectionState(); StreamConnectionState getConnectionState(); StreamConnectionId getStreamConnectionId(); void closeConnection(); boolean isClosed(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override void close(); static final UnsignedLong MAX_FRAMES_PER_CONNECTION; }