<commit_before>// Copyright 2014 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package ssdp

import (
	"net/http"
	"sync"
	"testing"
	"time"
)

func TestNotify(t *testing.T) {
	devln := Listener{LocalPort: "1901", MulticastLoopback: true}
	dev, err := devln.ListenDevice(nil)
	if err != nil {
		t.Fatal(err)
	}
	defer dev.Close()
	devhdlr := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		//t.Logf("DEV: %+v, %+v", w, req)
	})
	go dev.Serve(devhdlr)

	cpln := Listener{}
	cp, err := cpln.ListenControlPoint(nil)
	if err != nil {
		t.Fatal(err)
	}
	defer cp.Close()
	var rcvd = struct {
		sync.RWMutex
		reqs []*http.Request
	}{}<commit_msg>ssdp: deflake TestNotify<commit_after>// Copyright 2014 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package ssdp

import (
	"net/http"
	"sync"
	"testing"
	"time"
)

func TestNotify(t *testing.T) {
	devln := Listener{LocalPort: "1901", MulticastLoopback: true}
	dev, err := devln.ListenDevice(nil)
	if err != nil {
		t.Skipf("no available multicast network interface found: %v", err)
	}
	defer dev.Close()
	devhdlr := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		//t.Logf("DEV: %+v, %+v", w, req)
	})
	go dev.Serve(devhdlr)

	cpln := Listener{}
	cp, err := cpln.ListenControlPoint(nil)
	if err != nil {
		t.Fatal(err)
	}
	defer cp.Close()
	var rcvd = struct {
		sync.RWMutex
		reqs []*http.Request
	}{}
{'fraction_non_alphanumeric': 0.15355086372360843, 'fraction_numerical': 0.010236724248240563, 'mean_word_length': 3.768292682926829, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5781390', 'n_tokens_mistral': 634, 'n_tokens_neox': 613, 'n_words': 167}