mirror of
https://github.com/gortc/stun.git
synced 2025-12-24 12:57:54 +08:00
a:addr: add UnexpectedEOF test
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package stun
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
"testing"
|
||||
)
|
||||
@@ -47,6 +48,13 @@ func TestMappedAddress(t *testing.T) {
|
||||
t.Error("should error")
|
||||
}
|
||||
})
|
||||
t.Run("Bad length", func(t *testing.T) {
|
||||
message := new(Message)
|
||||
message.Add(AttrMappedAddress, []byte{1, 2, 3})
|
||||
if err := got.GetFrom(message); err != io.ErrUnexpectedEOF {
|
||||
t.Errorf("<%s> should be <%s>", err, io.ErrUnexpectedEOF)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user