/// <inheritdoc />
        public void Publish(Message message)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            if (!socket.Connected)
            {
                throw new InvalidOperationException("Not connected to the test runner.");
            }

            message.Validate();

            var messageData   = messageFormatter.Serialise(message);
            var framedMessage = new FramedMessage(messageData);

            framedMessage.WriteTo(socket);
        }