class ConnectionValidator {

    void validate(final Connection connection, final DittoHeaders dittoHeaders, final ActorSystem actorSystem) {
        final AbstractProtocolValidator spec = specMap.get(connection.getConnectionType());
        validateSourceAndTargetAddressesAreNonempty(connection, dittoHeaders);
        checkMappingNumberOfSourcesAndTargets(dittoHeaders, connection);
        validateFormatOfCertificates(connection, dittoHeaders);
        hostValidator.validateHostname(connection.getHostname(), dittoHeaders);
        if (spec != null) {
            // throw error at validation site for clarity of stack trace
            spec.validate(connection, dittoHeaders, actorSystem);
        } else {
            throw new IllegalStateException("Unknown connection type: " + connection);
        }
    }

    private  ConnectionValidator(
            final ConnectivityConfig connectivityConfig,
            LoggingAdapter loggingAdapter, final AbstractProtocolValidator... connectionSpecs);

}