forwarder.Write(envelope)

			Eventually(func() int { return client.WriteCallCount() }).Should(Equal(2))
			Eventually(func() []byte { return client.WriteArgsForCall(0) }).Should(Equal(buffer.Bytes()))
			Eventually(func() []byte { return client.WriteArgsForCall(1) }).Should(Equal(bytes))

			Eventually(func() uint64 { return sender.GetCounter("DopplerForwarder.sentMessages") }).Should(BeEquivalentTo(1))
			Eventually(func() uint64 { return sender.GetCounter("dropsondeMarshaller.logMessageMarshalled") }).Should(BeEquivalentTo(1))
		})

		Context("write returns an error", func() {
			BeforeEach(func() {
				client.WriteStub = func([]byte) (int, error) {
					switch client.WriteCallCount() {
					case 2:
						return 0, errors.New("write failure")
					default:
						return 0, nil
					}
				}
				forwarder.Write(envelope)
			})

			It("closes the client", func() {
				Eventually(func() int { return client.CloseCallCount() }).Should(Equal(1))
			})

			It("does not increment the marshallErrors metric", func() {
				Consistently(func() uint64 { return sender.GetCounter("dropsondeMarshaller.marshalErrors") }).Should(BeZero())
			})

			It("only increments retryCount metric and not other metrics", func() {