/** Tests to validate that a session holding JDBC resources will not be allowed to serialize. */
  @Test
  public final void testEnabledFilterSerialization() throws Throwable {
    prepare();
    Session sessionUnderTest = getSessionUnderTest();

    sessionUnderTest.enableFilter("nameIsNull");
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));
    disconnect(sessionUnderTest);
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));

    byte[] bytes = SerializationHelper.serialize(sessionUnderTest);
    checkSerializedState(sessionUnderTest);
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));
    reconnect(sessionUnderTest);
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));
    disconnect(sessionUnderTest);
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));

    Session s2 = (Session) SerializationHelper.deserialize(bytes);
    checkDeserializedState(s2);
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));
    reconnect(s2);
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));

    disconnect(s2);
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));
    reconnect(s2);
    assertNotNull(sessionUnderTest.getEnabledFilter("nameIsNull"));

    release(sessionUnderTest);
    release(s2);
    done();
  }
  /**
   * Test that the legacy manual disconnect()/reconnect() chain works as expected in the given
   * environment.
   */
  @Test
  public final void testManualDisconnectChain() throws Throwable {
    prepare();
    Session sessionUnderTest = getSessionUnderTest();

    disconnect(sessionUnderTest);

    byte[] bytes = SerializationHelper.serialize(sessionUnderTest);
    checkSerializedState(sessionUnderTest);
    Session s2 = (Session) SerializationHelper.deserialize(bytes);
    checkDeserializedState(s2);

    reconnect(s2);

    disconnect(s2);
    reconnect(s2);

    release(sessionUnderTest);
    release(s2);
    done();
  }