func getHeartbeatEvent(ie emitter.InstrumentedEmitter) *events.Heartbeat {
	return ie.GetHeartbeatEvent().(*events.Heartbeat)
}
import (
	"errors"
	"github.com/cloudfoundry-incubator/dropsonde/emitter"
	"github.com/cloudfoundry-incubator/dropsonde/emitter/fake"
	"github.com/cloudfoundry-incubator/dropsonde/events"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

func getHeartbeatEvent(ie emitter.InstrumentedEmitter) *events.Heartbeat {
	return ie.GetHeartbeatEvent().(*events.Heartbeat)
}

var _ = Describe("InstrumentedEmitter", func() {
	var fakeEmitter *fake.FakeByteEmitter
	var instrumentedEmitter emitter.InstrumentedEmitter

	BeforeEach(func() {
		fakeEmitter = fake.NewFakeByteEmitter()
		instrumentedEmitter, _ = emitter.NewInstrumentedEmitter(fakeEmitter)
	})

	Describe("Delegators", func() {

		It("delegates Close() to the concreteEmitter", func() {
			instrumentedEmitter.Close()
			Eventually(fakeEmitter.IsClosed).Should(BeTrue())
		})
	})

	Describe("Emit()", func() {