I am working on a WebRTC client that uses ice4j to process STUN/TURN
messages, which are in the WebRTC standard. In the Firefox implementation
of STUN stack, they reply to a Binding Request User a 401 (Unauthorized)
packet at the beginning of the communication, but after repeating some
times the Binding Request User the answer becomes the expected Binding
Success Response (with an XOR-MAPPED-ADDRESS).
On ice4j, when receiving a non successful response to a Binding Request
User the whole candidate pair is removed from the possible list.
I don't really know if the Firefox behaviour is contemplated in the STUN
standard, but I've done a modification in my ice4j to adapt the STUN stack
to this situation. The idea is that if a 401 response is received, I resend
a Binding Request User after 100 milliseconds. If I receive a 401 10 times
or more it is when I finally reject the candidate pair.
I enclose a possible implementation of the method processErrorResponse in
the ConnectivityCheckClient class and the Wireshark capture of the STUN
packets that have been sent in my implementation.
processErrorResponse.java (3.37 KB)
stun401ice4j.pcap (5.75 KB)