junit-servers-core/src/main/java/com/github/mjeanroy/junit/servers/engine/Servers.java
@SuppressWarnings("unchecked")
	public static EmbeddedServer<?> instantiate(AbstractConfiguration configuration) {
		ServiceLoader<EmbeddedServerProvider> serviceProviders = ServiceLoader.load(EmbeddedServerProvider.class);

		List<EmbeddedServerProvider> coreServerProviders = new ArrayList<>();
		List<EmbeddedServerProvider> customServerProviders = new ArrayList<>();

		for (EmbeddedServerProvider provider : serviceProviders) {
			if (provider.getClass().getName().startsWith("com.github.mjeanroy.junit.servers")) {
				coreServerProviders.add(provider);
			}
			else {
				customServerProviders.add(provider);
			}
		}

		// No match, fail fast.
		if (coreServerProviders.isEmpty() && customServerProviders.isEmpty()) {
			throw new ServerImplMissingException();
		}

		// Choose the first one available.
		if (customServerProviders.isEmpty()) {
			return instantiate(coreServerProviders.get(0), configuration);
		}

		// Try to instantiate the custom available implementation.
		if (customServerProviders.size() > 1) {
			throw new ServerImplMissingException();
		}

		return instantiate(coreServerProviders.get(0), configuration);
	}
@SuppressWarnings("unchecked")
	public static EmbeddedServer<?> instantiate(AbstractConfiguration configuration) {
		ServiceLoader<EmbeddedServerProvider> serviceProviders = ServiceLoader.load(EmbeddedServerProvider.class);

		List<EmbeddedServerProvider> coreServerProviders = new ArrayList<>();
		List<EmbeddedServerProvider> customServerProviders = new ArrayList<>();

		for (EmbeddedServerProvider provider : serviceProviders) {
			if (provider.getClass().getName().startsWith("com.github.mjeanroy.junit.servers")) {
				coreServerProviders.add(provider);
			}
			else {
				customServerProviders.add(provider);
			}
		}

		// No match, fail fast.
		if (coreServerProviders.isEmpty() && customServerProviders.isEmpty()) {
			throw new ServerImplMissingException();
		}

		// Choose the first one available.
		if (customServerProviders.isEmpty()) {
			return instantiate(coreServerProviders.get(0), configuration);
		}

		// Try to instantiate the custom available implementation.
		if (customServerProviders.size() > 1) {
			throw new ServerImplMissingException();
		}

		return instantiate(coreServerProviders.get(0), configuration);
	}
Instantiate jetty or tomcat embedded server.

<p>

Configuration is an optional parameter and can be null.
If configuration is null, empty constructor will be used to instantiate
embedded server.
Otherwise, constructor with one parameter (configuration) will
be used.

<p>

Server implementation is automatically detected (jetty or
tomcat) with classpath detection.

@param configuration Optional configuration.
@return Embedded server.