<commit_before>use Test;

# RT #129213

plan 10;

class Dummy { has ($.a, $.b, $.c, $.d, $.e) }

my $c = Channel.new;
my $ready = Promise.new;

start {
    my $listen = IO::Socket::INET.new(:listen, :localport(10333));
    $ready.keep(True);
    loop {
        my $conn = $listen.accept;
        while my $buf = $conn.recv(:bin) {
            $conn.write: $buf;
            start {
                Dummy.new(:1a, :2b, :3c, :4d, :5e) for ^3000;
                $c.send('ok');
            }
        }
        $conn.close;
    }
}


await $ready;
for ^5 {
    my $conn = IO::Socket::INET.new(:host<localhost>, :port(10333));
    $conn.print: "Don't hang up";
    is $conn.recv, "Don't hang up", "Server responded ($_)";
    $conn.close;
}

for ^5 {
    is $c.receive, 'ok', "Started work was completed ($_)";
}
<commit_msg>:host<localhost> doesn't work on OS X ?<commit_after>use Test;

# RT #129213

plan 10;

class Dummy { has ($.a, $.b, $.c, $.d, $.e) }

my $c = Channel.new;
my $ready = Promise.new;

start {
    my $listen = IO::Socket::INET.new(:listen, :localport(10333));
    $ready.keep(True);
    loop {
        my $conn = $listen.accept;
        while my $buf = $conn.recv(:bin) {
            $conn.write: $buf;
            start {
                Dummy.new(:1a, :2b, :3c, :4d, :5e) for ^3000;
                $c.send('ok');
            }
        }
        $conn.close;
    }
}


await $ready;
for ^5 {
    my $conn = IO::Socket::INET.new(:host<127.0.0.1>, :port(10333));
    $conn.print: "Don't hang up";
    is $conn.recv, "Don't hang up", "Server responded ($_)";
    $conn.close;
}

for ^5 {
    is $c.receive, 'ok', "Started work was completed ($_)";
}

{'fraction_non_alphanumeric': 0.1992797118847539, 'fraction_numerical': 0.03841536614645858, 'mean_word_length': 2.1217228464419478, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '1678325', 'n_tokens_mistral': 684, 'n_tokens_neox': 642, 'n_words': 156}