func TestConcurrentUPNP(t *testing.T) {
	if testing.Short() {
		t.SkipNow()
	}
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
	defer cancel()
	_, err := DiscoverCtx(ctx)
	if err != nil {
		t.Skip(err)
	}
	var wg sync.WaitGroup
	for i := 0; i < 20; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
			defer cancel()
			_, err := DiscoverCtx(ctx)
			if err != nil {
				t.Error(err)
			}
		}()
	}
	wg.Wait()
}
TestConcurrentUPNP tests that several threads calling Discover() concurrently
succeed.
package upnp
import (
	"context"
	"sync"
	"testing"
	"time"
)