@Test public void shouldPersistAsInRfcErrata() { final ClientSideState clientSideState = new ClientSideState(RFC_EDITION, ClientSideStateTest::rfcTime, ClientSideStateTest::rfcIV, ClientSideStateTest::serialize, ClientSideStateTest::deserialize, ClientSideState.DEFAULT_TIMEOUT); final NewCookie cookie = clientSideState.persist("id", "/path", "a state string"); assertThat(cookie).isNotNull(); assertThat(cookie.getName()).isEqualTo("id"); assertThat(cookie.getValue()) .isEqualTo("pzSOjcNui9-HWS_Qk1Pwpg|MTM0NzI2NTk1NQ|dGlk|tL3lJPf2nUSFMN6dtVXJTw|uea1fgC67RmOxfpNz8gMbnPWfDA"); assertThat(cookie.getPath()).isEqualTo("/path"); assertThat(cookie.isHttpOnly()).isFalse(); assertThat(cookie.isSecure()).isTrue(); }
@SuppressWarnings("JdkObsolete") public NewCookie persist(final String key, final String path, final Object value) { final Date expiry = Date.from(ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(timeout).toInstant()); return new NewCookie(key, protect(value), path, null, Cookie.DEFAULT_VERSION, null, timeout, expiry, true, false); }
ClientSideState { @SuppressWarnings("JdkObsolete") public NewCookie persist(final String key, final String path, final Object value) { final Date expiry = Date.from(ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(timeout).toInstant()); return new NewCookie(key, protect(value), path, null, Cookie.DEFAULT_VERSION, null, timeout, expiry, true, false); } }
ClientSideState { @SuppressWarnings("JdkObsolete") public NewCookie persist(final String key, final String path, final Object value) { final Date expiry = Date.from(ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(timeout).toInstant()); return new NewCookie(key, protect(value), path, null, Cookie.DEFAULT_VERSION, null, timeout, expiry, true, false); } ClientSideState(final Edition edition);  ClientSideState(final Edition edition, final int timeout);   ClientSideState(final Edition edition, final LongSupplier timeSource, final int timeout);   ClientSideState(final Edition edition, final LongSupplier timeSource, final Supplier<byte[]> ivSource,
        final Function<Object, byte[]> serialization, final BiFunction<Class<?>, byte[], Object> deserialization, final int timeout); }
ClientSideState { @SuppressWarnings("JdkObsolete") public NewCookie persist(final String key, final String path, final Object value) { final Date expiry = Date.from(ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(timeout).toInstant()); return new NewCookie(key, protect(value), path, null, Cookie.DEFAULT_VERSION, null, timeout, expiry, true, false); } ClientSideState(final Edition edition);  ClientSideState(final Edition edition, final int timeout);   ClientSideState(final Edition edition, final LongSupplier timeSource, final int timeout);   ClientSideState(final Edition edition, final LongSupplier timeSource, final Supplier<byte[]> ivSource,
        final Function<Object, byte[]> serialization, final BiFunction<Class<?>, byte[], Object> deserialization, final int timeout); @SuppressWarnings("JdkObsolete") NewCookie persist(final String key, final String path, final Object value); Set<T> restoreFrom(final Collection<Cookie> cookies, final Class<T> type); T restoreFrom(final Cookie cookie, final Class<T> type); }
ClientSideState { @SuppressWarnings("JdkObsolete") public NewCookie persist(final String key, final String path, final Object value) { final Date expiry = Date.from(ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(timeout).toInstant()); return new NewCookie(key, protect(value), path, null, Cookie.DEFAULT_VERSION, null, timeout, expiry, true, false); } ClientSideState(final Edition edition);  ClientSideState(final Edition edition, final int timeout);   ClientSideState(final Edition edition, final LongSupplier timeSource, final int timeout);   ClientSideState(final Edition edition, final LongSupplier timeSource, final Supplier<byte[]> ivSource,
        final Function<Object, byte[]> serialization, final BiFunction<Class<?>, byte[], Object> deserialization, final int timeout); @SuppressWarnings("JdkObsolete") NewCookie persist(final String key, final String path, final Object value); Set<T> restoreFrom(final Collection<Cookie> cookies, final Class<T> type); T restoreFrom(final Cookie cookie, final Class<T> type); static final int DEFAULT_TIMEOUT; }