Files
fscan/plugins/services/mqtt_test.go
T
ZacharyZcR 8d30ee334c
测试构建 / 代码检查 (push) Has been cancelled
测试构建 / 单元测试和构建 (push) Has been cancelled
测试构建 / 构建验证 (push) Has been cancelled
Add native protocol service plugins
2026-05-23 15:51:50 +08:00

20 lines
449 B
Go

//go:build plugin_mqtt || !plugin_selective
package services
import (
"strings"
"testing"
)
func TestParseMQTTConnack(t *testing.T) {
banner, ok := parseMQTTConnack([]byte{0x20, 0x02, 0x00, 0x05})
if !ok || !strings.Contains(banner, "not authorized") {
t.Fatalf("unexpected mqtt banner: %q ok=%v", banner, ok)
}
if _, ok := parseMQTTConnack([]byte{0x10, 0x02, 0x00, 0x00}); ok {
t.Fatal("unexpected match for non-connack packet")
}
}