static MongoInstance create() {
    final String uri = System.getProperty("mongo");


    if (uri != null) {
      // connect to remote mongo server
      return new MongoInstance(MongoClients.create(uri));
    }

    final MongoServer server = new MongoServer(new MemoryBackend());
    final InetSocketAddress address = server.bind();
    final Closer closer = Closer.create();
    closer.register(server::shutdownNow);

    final MongoClient client = MongoClients.create(String.format("mongodb://127.0.0.1:%d", address.getPort()));
    return new MongoInstance(client, closer);
  }
Detect if current mongo instance is fake (as in <a href="https://github.com/bwaldvogel/mongo-java-server">Mongo Java Server</a>)
or real (stand-alone database or docker container).
criteria/mongo/test/org/immutables/criteria/mongo/MongoInstance.java