<commit_before>package lineserver

import (
	"testing"
)

var clientMessage = "clientV12345\n"
var serverAddress = "localhost:8311"

func TestCreate(t *testing.T) {
	syncAccept = make(chan bool)
	go setupServer(t)
	setupClient(t)
}

func setupClient(t *testing.T) {
	s := NewServer(serverAddress)
	// wait until the server is waiting
	<-syncAccept

	writer := s.Connect()
	_, err := writer.Write([]byte(clientMessage))
	if err != nil {
		t.Errorf("Failed write")
		return
	}
	writer.Flush()

	<-syncAccept
	s.Close()
}

func setupServer(t *testing.T) {
	s := NewServer(serverAddress)
	reader, err := s.Accept()
	if err != nil {
		t.Errorf("Failed accept")
		return
	}

	val, err := reader.ReadString('\n')<commit_msg>fix test call using Connect()<commit_after>package lineserver

import (
	"testing"
)

var clientMessage = "clientV12345\n"
var serverAddress = "localhost:8311"

func TestCreate(t *testing.T) {
	syncAccept = make(chan bool)
	go setupServer(t)
	setupClient(t)
}

func setupClient(t *testing.T) {
	s := NewServer(serverAddress)
	// wait until the server is waiting
	<-syncAccept

	writer, err := s.Connect()
	if err != nil {
		t.Errorf("Failed write")
		return
	}
	_, err = writer.Write([]byte(clientMessage))
	if err != nil {
		t.Errorf("Failed write")
		return
	}
	writer.Flush()

	<-syncAccept
	s.Close()
}

func setupServer(t *testing.T) {
	s := NewServer(serverAddress)
	reader, err := s.Accept()
	if err != nil {
		t.Errorf("Failed accept")
		return
	}

	val, err := reader.ReadString('\n')
{'fraction_non_alphanumeric': 0.1490066225165563, 'fraction_numerical': 0.011920529801324504, 'mean_word_length': 4.139455782312925, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '4486247', 'n_tokens_mistral': 574, 'n_tokens_neox': 541, 'n_words': 132}