<commit_before>package com.github.kpavlov.jreactive8583.example.client;

import com.github.kpavlov.jreactive8583.client.ClientConfiguration;
import com.github.kpavlov.jreactive8583.client.Iso8583Client;
import com.github.kpavlov.jreactive8583.iso.ISO8583Version;
import com.github.kpavlov.jreactive8583.iso.J8583MessageFactory;
import com.github.kpavlov.jreactive8583.iso.MessageFactory;
import com.solab.iso8583.IsoMessage;
import com.solab.iso8583.impl.SimpleTraceGenerator;
import com.solab.iso8583.parse.ConfigParser;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;

import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE;

@Configuration
public class Iso8583ClientConfig {

    @Value("${iso8583.connection.host}")
    private String host;

    @Value("${iso8583.connection.port}")
    private int port;

    @Value("${iso8583.connection.idleTimeout}")
    private int idleTimeout;

    @Bean
    @Scope(SCOPE_PROTOTYPE)
    public Iso8583Client<IsoMessage> iso8583Client() throws IOException {
        final SocketAddress socketAddress = new InetSocketAddress(host, port);

        final var configuration = ClientConfiguration.newBuilder()
//                .addLoggingHandler()
                .idleTimeout(idleTimeout)
                .logSensitiveData(false)
                .workerThreadsCount(2)
                .build();

        return new Iso8583Client<>(socketAddress, configuration, clientMessageFactory());
    }

    private MessageFactory<IsoMessage> clientMessageFactory() throws IOException {
        final var messageFactory = ConfigParser.createDefault();
        messageFactory.setCharacterEncoding(StandardCharsets.US_ASCII.name());
        messageFactory.setUseBinaryMessages(false);
        messageFactory.setAssignDate(true);
        messageFactory.setTraceNumberGenerator(new SimpleTraceGenerator((int) (System
                .currentTimeMillis() % 1000000)));
        return new J8583MessageFactory<>(messageFactory, ISO8583Version.V1987);
    }
}
<commit_msg>Enable logging in tests<commit_after>package com.github.kpavlov.jreactive8583.example.client;

import com.github.kpavlov.jreactive8583.client.ClientConfiguration;
import com.github.kpavlov.jreactive8583.client.Iso8583Client;
import com.github.kpavlov.jreactive8583.iso.ISO8583Version;
import com.github.kpavlov.jreactive8583.iso.J8583MessageFactory;
import com.github.kpavlov.jreactive8583.iso.MessageFactory;
import com.solab.iso8583.IsoMessage;
import com.solab.iso8583.impl.SimpleTraceGenerator;
import com.solab.iso8583.parse.ConfigParser;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;

import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE;

@Configuration
public class Iso8583ClientConfig {

    @Value("${iso8583.connection.host}")
    private String host;

    @Value("${iso8583.connection.port}")
    private int port;

    @Value("${iso8583.connection.idleTimeout}")
    private int idleTimeout;

    @Bean
    @Scope(SCOPE_PROTOTYPE)
    public Iso8583Client<IsoMessage> iso8583Client() throws IOException {
        final SocketAddress socketAddress = new InetSocketAddress(host, port);

        final var configuration = ClientConfiguration.newBuilder()
            .addLoggingHandler(true)
                .idleTimeout(idleTimeout)
                .logSensitiveData(false)
                .workerThreadsCount(2)
                .build();

        return new Iso8583Client<>(socketAddress, configuration, clientMessageFactory());
    }

    private MessageFactory<IsoMessage> clientMessageFactory() throws IOException {
        final var messageFactory = ConfigParser.createDefault();
        messageFactory.setCharacterEncoding(StandardCharsets.US_ASCII.name());
        messageFactory.setUseBinaryMessages(false);
        messageFactory.setAssignDate(true);
        messageFactory.setTraceNumberGenerator(new SimpleTraceGenerator((int) (System
                .currentTimeMillis() % 1000000)));
        return new J8583MessageFactory<>(messageFactory, ISO8583Version.V1987);
    }
}

{'fraction_non_alphanumeric': 0.09489361702127659, 'fraction_numerical': 0.04085106382978723, 'mean_word_length': 4.428406466512702, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7254027', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1298, 'n_words': 205}