Package spec provides functionality for testing MQTT 3.1.1 broker implementations.
Get it using go's standard toolset:
$ go get github.com/gomqtt/specfunc TestSpec(t *testing.T) {
config := AllFeatures()
config.URL = "tcp://localhost:1883"
// mosquitto specific config
config.Authentication = false
config.MessageRetainWait = 300 * time.Millisecond
config.NoMessageWait = 100 * time.Millisecond
Run(t, config)
}