<commit_before>package enmasse.systemtest.amqp;

import io.vertx.core.AbstractVerticle;
import io.vertx.proton.ProtonClient;
import io.vertx.proton.ProtonConnection;
import org.apache.qpid.proton.amqp.transport.ErrorCondition;

import java.util.concurrent.CompletableFuture;

public abstract class ClientHandlerBase<T> extends AbstractVerticle {

    private final enmasse.systemtest.Endpoint endpoint;
    protected final ClientOptions clientOptions;
    protected final CompletableFuture<T> promise;

    public ClientHandlerBase(enmasse.systemtest.Endpoint endpoint, ClientOptions clientOptions, CompletableFuture<T> promise) {
        this.endpoint = endpoint;
        this.clientOptions = clientOptions;
        this.promise = promise;
    }

    @Override
    public void start() {
        ProtonClient client = ProtonClient.create(vertx);
        client.connect(clientOptions.getProtonClientOptions(), endpoint.getHost(), endpoint.getPort(), connection -> {
            if (connection.succeeded()) {
                ProtonConnection conn = connection.result();
                conn.setContainer("enmasse-systemtest-client");
                conn.openHandler(result -> {
                    if (result.failed()) {
                        promise.completeExceptionally(result.cause());
                    } else {
                        connectionOpened(conn);
                    }
                });
                conn.closeHandler(result -> {
                    if (result.failed()) {
                        promise.completeExceptionally(result.cause());
                    } else {
                        connectionClosed(conn);
                    }
                });
                conn.disconnectHandler(result -> connectionDisconnected(conn));
                conn.open();
            } else {
                System.out.println("Connection to " + endpoint.getHost() + ":" + endpoint.getPort() + " failed: " + connection.cause().getMessage());
                promise.completeExceptionally(connection.cause());
            }
        });
        System.out.println("Client started");
    }

    @Override
    public void stop() {
        System.out.println("Client stopped");
    }

    protected abstract void connectionOpened(ProtonConnection conn);
    protected abstract void connectionClosed(ProtonConnection conn);
    protected abstract void connectionDisconnected(ProtonConnection conn);

    protected void handleError(ErrorCondition error) {
        if (error == null || error.getCondition() == null) {
            System.out.println("Link closed without error");
        } else {
            System.out.println("Link closed with " + error);
            promise.completeExceptionally(new RuntimeException(error.getDescription()));
        }
    }
}<commit_msg>Remove debug print<commit_after>package enmasse.systemtest.amqp;

import io.vertx.core.AbstractVerticle;
import io.vertx.proton.ProtonClient;
import io.vertx.proton.ProtonConnection;
import org.apache.qpid.proton.amqp.transport.ErrorCondition;

import java.util.concurrent.CompletableFuture;

public abstract class ClientHandlerBase<T> extends AbstractVerticle {

    private final enmasse.systemtest.Endpoint endpoint;
    protected final ClientOptions clientOptions;
    protected final CompletableFuture<T> promise;

    public ClientHandlerBase(enmasse.systemtest.Endpoint endpoint, ClientOptions clientOptions, CompletableFuture<T> promise) {
        this.endpoint = endpoint;
        this.clientOptions = clientOptions;
        this.promise = promise;
    }

    @Override
    public void start() {
        ProtonClient client = ProtonClient.create(vertx);
        client.connect(clientOptions.getProtonClientOptions(), endpoint.getHost(), endpoint.getPort(), connection -> {
            if (connection.succeeded()) {
                ProtonConnection conn = connection.result();
                conn.setContainer("enmasse-systemtest-client");
                conn.openHandler(result -> {
                    if (result.failed()) {
                        promise.completeExceptionally(result.cause());
                    } else {
                        connectionOpened(conn);
                    }
                });
                conn.closeHandler(result -> {
                    if (result.failed()) {
                        promise.completeExceptionally(result.cause());
                    } else {
                        connectionClosed(conn);
                    }
                });
                conn.disconnectHandler(result -> connectionDisconnected(conn));
                conn.open();
            } else {
                System.out.println("Connection to " + endpoint.getHost() + ":" + endpoint.getPort() + " failed: " + connection.cause().getMessage());
                promise.completeExceptionally(connection.cause());
            }
        });
    }

    protected abstract void connectionOpened(ProtonConnection conn);
    protected abstract void connectionClosed(ProtonConnection conn);
    protected abstract void connectionDisconnected(ProtonConnection conn);

    protected void handleError(ErrorCondition error) {
        if (error == null || error.getCondition() == null) {
            System.out.println("Link closed without error");
        } else {
            System.out.println("Link closed with " + error);
            promise.completeExceptionally(new RuntimeException(error.getDescription()));
        }
    }
}
{'fraction_non_alphanumeric': 0.10100824931255728, 'fraction_numerical': 0.0, 'mean_word_length': 2.2514898688915377, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 17, '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': '935529', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1275, 'n_words': 246}