<commit_before>package net.kencochrane.raven.connection;

import net.kencochrane.raven.Dsn;
import net.kencochrane.raven.Raven;

/**
 * Abstract connection to a Sentry server.
 * <p>
 * Provide the basic tools to submit events to the server (authentication header, dsn).
 * </p>
 */
public abstract class AbstractConnection implements Connection {
    /**
     * Current sentry protocol version.
     */
    public static final String SENTRY_PROTOCOL_VERSION = "3";
    private final String publicKey;
    private final String secretKey;

    /**
     * Creates a connection based on a DSN.
     *
     * @param dsn Data Source Name of the sentry server.
     */
    protected AbstractConnection(Dsn dsn) {
        this(dsn.getPublicKey(), dsn.getSecretKey());
    }

    /**
     * Creates a connection based on the public and secret keys.
     *
     * @param publicKey public key (identifier) to the Sentry server.
     * @param secretKey secret key (password) to the Sentry server.
     */
    protected AbstractConnection(String publicKey, String secretKey) {
        this.publicKey = publicKey;
        this.secretKey = secretKey;
    }

    /**
     * Creates an authentication header for the sentry protocol.
     *
     * @return an authentication header as a String.
     */
    protected String getAuthHeader() {
        //TODO: Consider adding back signature? Not a priority, probably not worth it.
        StringBuilder header = new StringBuilder();<commit_msg>Update protocol version to 4<commit_after>package net.kencochrane.raven.connection;

import net.kencochrane.raven.Dsn;
import net.kencochrane.raven.Raven;

/**
 * Abstract connection to a Sentry server.
 * <p>
 * Provide the basic tools to submit events to the server (authentication header, dsn).
 * </p>
 */
public abstract class AbstractConnection implements Connection {
    /**
     * Current sentry protocol version.
     */
    public static final String SENTRY_PROTOCOL_VERSION = "4";
    private final String publicKey;
    private final String secretKey;

    /**
     * Creates a connection based on a DSN.
     *
     * @param dsn Data Source Name of the sentry server.
     */
    protected AbstractConnection(Dsn dsn) {
        this(dsn.getPublicKey(), dsn.getSecretKey());
    }

    /**
     * Creates a connection based on the public and secret keys.
     *
     * @param publicKey public key (identifier) to the Sentry server.
     * @param secretKey secret key (password) to the Sentry server.
     */
    protected AbstractConnection(String publicKey, String secretKey) {
        this.publicKey = publicKey;
        this.secretKey = secretKey;
    }

    /**
     * Creates an authentication header for the sentry protocol.
     *
     * @return an authentication header as a String.
     */
    protected String getAuthHeader() {
        //TODO: Consider adding back signature? Not a priority, probably not worth it.
        StringBuilder header = new StringBuilder();
{'fraction_non_alphanumeric': 0.08504893688828889, 'fraction_numerical': 0.0010124873439082012, 'mean_word_length': 2.8048780487804876, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '832352', 'n_tokens_mistral': 804, 'n_tokens_neox': 788, 'n_words': 289}