ReadOnlySession implements Session { @Override public void invalidate() { throw new Error("session is readonly for websocket"); } ReadOnlySession(Session session); @Override Optional<String> get(String key); @Override void set(String key, String value); @Override void invalidate();  }
@Test void invalidate() { assertThatThrownBy(() -> session.invalidate()) .isInstanceOf(Error.class) .hasMessageContaining("readonly"); }