@Test
public void setTimeoutInDatabaseFactory() {

    long initialTimeoutMillis = fdb.getFactory().getTransactionTimeoutMillis();
    try {
        fdb.getFactory().setTransactionTimeoutMillis(1066L);
        try (FDBRecordContext context = fdb.openContext()) {
            assertEquals(1066L, context.getTimeoutMillis(), "timeout millis did not match factory timeout");
        }
        fdb.getFactory().setTransactionTimeoutMillis(FDBDatabaseFactory.DEFAULT_TR_TIMEOUT_MILLIS);
        try (FDBRecordContext context = fdb.openContext()) {
            assertEquals(FDBDatabaseFactory.DEFAULT_TR_TIMEOUT_MILLIS, context.getTimeoutMillis(), "timeout millis did not match default");
        }
    } finally {
        fdb.getFactory().setTransactionTimeoutMillis(initialTimeoutMillis);
    }
}