### Question:
BaseRdbmsProvider implements DBRdbmsProvider { @NotNull @Override public BaseFacade openFacade(@NotNull final String connectionString, @Nullable final Properties connectionProperties, final int connectionsLimit, final boolean connect) { boolean ok = false; final IntegralIntermediateFacade intermediateFacade = myIntermediateProvider.openFacade(connectionString, connectionProperties, connectionsLimit); try { final BaseFacade facade = new BaseFacade(intermediateFacade); if (connect) { facade.connect(); } ok = true; return facade; } finally { if (!ok) { intermediateFacade.disconnect(); } } } BaseRdbmsProvider(@NotNull final PrimeIntermediateRdbmsProvider primeIntermediateProvider);  BaseRdbmsProvider(@NotNull final IntegralIntermediateRdbmsProvider integralIntermediateProvider); @NotNull @Override Rdbms rdbms(); @NotNull @Override Pattern connectionStringPattern(); @NotNull @Override BaseFacade openFacade(@NotNull final String connectionString,
                               @Nullable final Properties connectionProperties,
                               final int connectionsLimit,
                               final boolean connect); @Nullable @Override I getSpecificService(@NotNull final Class<I> serviceClass,
                                  @NotNull final String serviceName);  }### Answer:
@Test public void connect_directly() { final BaseRdbmsProvider provider = new BaseRdbmsProvider(ourUnknownDatabaseProvider); final BaseFacade facade = provider.openFacade(H2_CONNECTION_STRING, null, 1, true); assertThat(facade.isConnected()).isTrue(); facade.disconnect(); assertThat(facade.isConnected()).isFalse(); }
@Test public void connect_remotely() { final BaseRdbmsProvider provider = new BaseRdbmsProvider(ourUnknownDatabaseProvider); final BaseFacade facade = provider.openFacade(H2_CONNECTION_STRING, null, 1, true); assertThat(facade.isConnected()).isTrue(); facade.disconnect(); assertThat(facade.isConnected()).isFalse(); }