@Test
public void setTimeoutInConfig() {

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