"time"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"code.cloudfoundry.org/localip"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/storeadapter"
	"github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner"
	ginkgoConfig "github.com/onsi/ginkgo/config"
)

var _ = Describe("Announcer", func() {
	var (
		localIP     string
		conf        config.Config
		etcdRunner  *etcdstorerunner.ETCDClusterRunner
		etcdAdapter storeadapter.StoreAdapter
	)

	BeforeSuite(func() {
		localIP, _ = localip.LocalIP()

		etcdPort := 5500 + ginkgoConfig.GinkgoConfig.ParallelNode*10
		etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
		etcdRunner.Start()

		etcdAdapter = etcdRunner.Adapter(nil)

		conf = config.Config{
			JobName: "doppler_z1",
			Index:   "0",
	"net"
	"time"

	dopplerconfig "doppler/config"
	"doppler/dopplerservice"

	"github.com/cloudfoundry/gosteno"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Protocol", func() {
	var (
		protocols     []config.Protocol
		logger        *gosteno.Logger
		dopplerConfig *dopplerconfig.Config

		stopTheWorld chan struct{}
		stopAnnounce chan chan bool
	)

	BeforeEach(func() {
		protocols = nil
		logger = gosteno.NewLogger("test")
		dopplerConfig = &dopplerconfig.Config{
			Index:           0,
			JobName:         "job",
			Zone:            "z9",
			IncomingUDPPort: uint32(metronRunner.DropsondePort),
			TLSListenerConfig: dopplerconfig.TLSListenerConfig{
				Port:     uint32(port + 5),
				CertFile: "../fixtures/server.crt",