package client

import (
	"fmt"
	"sync"
	"testing"
	"time"
)

func Test_houstonClient_Start(t *testing.T) {
	tc := make(chan int, 1000)
	var wg sync.WaitGroup
	wg.Add(1)

	go func() {
		// receive
		defer wg.Done()

		for v := range tc {
			fmt.Println(v)
			time.Sleep(100 * time.Millisecond)
		}
	}()

	go func() {
		// send
		for i := 0; i < 100; i++ {
			tc <- i
		}
		close(tc)
		fmt.Println("channel close called")
	}()

	wg.Wait()
}
