@Test public void transitionConnectionState() { assertThat(streamConnection.isClosed()).isFalse(); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.AVAILABLE); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.AVAILABLE); streamConnection.transitionConnectionState(); assertThat(streamConnection.isClosed()).isFalse(); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.OPEN); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.OPEN); streamConnection.transitionConnectionState(); assertThat(streamConnection.isClosed()).isTrue(); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.CLOSED); assertThat(streamConnection.isClosed()).isTrue(); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.CLOSED); streamConnection.transitionConnectionState(); streamConnection.transitionConnectionState(); streamConnection.transitionConnectionState(); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.CLOSED); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.CLOSED); assertThat(streamConnection.isClosed()).isTrue(); }
public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); }
StreamConnection implements Closeable { public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } }
StreamConnection implements Closeable { public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret);  StreamConnection(final StreamConnectionId streamConnectionId); }
StreamConnection implements Closeable { public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } 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 void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } 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; }