ICE - Interactive Connectivity Establishment

What is ICE?

ICE is a framework used in real-time communication protocols (like WebRTC and VoIP) to find the best path for media streams (audio, video, data) between two peers. It helps devices behind NATs (Network Address Translators) and firewalls establish a direct connection.

Why is ICE useful?

  • Enables peer-to-peer communication even when devices are behind NATs or firewalls

  • Improves connection reliability by trying multiple network paths

  • Optimizes media quality by selecting the fastest and most stable route

  • Supports fallback to relay servers (TURN) if direct connection fails

How it works?

  • Candidate Gathering – Each peer collects possible IP addresses and ports (called “candidates”) from local interfaces, STUN, and TURN servers

  • Candidate Exchange – Peers exchange their candidates via signaling (e.g., SDP in WebRTC)

  • Connectivity Checks – Peers test each candidate pair using STUN to see which paths work

  • Nomination – The best working candidate pair is selected for communication

  • Connection Established – Media/data flows through the selected path

Where is ICE used?

  • WebRTC applications – Video conferencing, screen sharing, and real-time chat

  • VoIP systems – SIP-based voice and video calls

  • Online gaming – Peer-to-peer multiplayer connections

  • IoT and smart devices – Secure and efficient device-to-device communication

Which OSI layer does ICE belong to?

  • ICE is implemented in application-level protocols like WebRTC and SIP

  • It interacts with signaling protocols and uses STUN/TURN at the transport layer

  • It belongs to the Application Layer (Layer 7) of the OSI model

  • In this section, you are going to learn

  • Terminology

  • Version Info

sno

ICE Version

RFC / Standard

Core / Contribution

Year

1

ICE (Original Specification)

RFC 5245

Initial standard defining ICE for NAT traversal using STUN and TURN

2010

2

ICE (Updated Specification)

RFC 8445

Major revision of ICE, improving clarity and interoperability; obsoletes RFC 5245

2018

3

Trickle ICE

RFC 8838

Allows incremental candidate gathering and exchange to speed up ICE negotiation

2021

4

ICE PAC (Patiently Awaiting Connectivity)

RFC 8863

Defines ICE PAC behavior for endpoints that wait for connectivity before sending media

2021

5

ICE for Dual-Stack and Multihomed Hosts

RFC 8421

Best practices for using ICE in dual-stack (IPv4/IPv6) and multihomed environments

2018

  • Setup

  • Setup

STUN Binding Request

S.No

Protocol Packets

Description

Size(Bytes)

1

STUN Binding Request

Sent to test connectivity between peers and gather candidates

~56120

Message Type

Identifies as Binding Request

2

Message Length

Length of message body

2

Magic Cookie

Fixed value to identify STUN

4

Transaction ID

Unique ID for matching requests/responses

12

Attributes

Optional fields (e.g., username, priority)

20100

STUN Binding Response

2

STUN Binding Response

Response to a binding request with mapped address info

~56120

Message Type

Identifies as Binding Response

2

Message Length

Length of message body

2

Magic Cookie

Fixed value to identify STUN

4

Transaction ID

Matches the request

12

MAPPED-ADDRESS

Public IP and port of the sender

820

Attributes

Additional info (e.g., XOR-MAPPED-ADDRESS)

2080

STUN Binding Error

3

STUN Binding Error

Indicates failure in connectivity check

~56120

Message Type

Identifies as Binding Error Response

2

Message Length

Length of message body

2

Magic Cookie

Fixed value to identify STUN

4

Transaction ID

Matches the request

12

ERROR-CODE

Numeric error code and reason phrase

~1240

Attributes

Optional (e.g., realm, nonce)

~2060

Candidate Exchange (SDP)

4

Candidate Exchange (SDP)

Exchanged via signaling to share ICE candidates

~3001500 (in SDP)

Foundation

Unique ID for candidate

~510

Component ID

RTP or RTCP

1

Transport Protocol

UDP or TCP

3

Priority

ICE priority value

4

IP Address

Candidate IP

416

Port

Candidate port

2

Candidate Type

Host, Reflexive, Relayed

~1020

Related Address

For reflexive/relay candidates

~416

Connectivity Check

5

Connectivity Check

STUN packets sent periodically to test candidate pairs

~60120

Message Type

Binding Request

2

Message Length

Length of message body

2

Magic Cookie

Fixed value to identify STUN

4

MESSAGE-INTEGRITY

HMAC-SHA1 hash

20

Nomination Packet

6

Nomination Packet

Marks a successful candidate pair for media transport

~60120

Message Type

Binding Request

2

Transaction ID

Unique ID

12

USE-CANDIDATE

Marks candidate as nominated

4

PRIORITY

ICE priority

4

MESSAGE-INTEGRITY

HMAC-SHA1 hash

20

TURN Allocation Request

7

TURN Allocation Request

Requests relay allocation from TURN server

~80200

Message Type

Allocation Request

2

Transaction ID

Unique ID

12

USERNAME

Authenticated user

~1050

NONCE

Used for authentication

~1050

REALM

Authentication realm

~1050

REQUESTED-TRANSPORT

Protocol (UDP/TCP)

4

TURN Data Packet

8

TURN Data Packet

Relayed media/data packet via TURN server

~1001500

Channel Number

TURN channel identifier

2

Length

Length of the data

2

Data

Actual media or application data

201460

Keep-Alive Packet

9

Keep-Alive Packet

Periodic STUN packet to maintain NAT bindings

~60100

Message Type

Binding Request

2

Transaction ID

Unique ID

12

USERNAME

ICE username fragment

~1030

MESSAGE-INTEGRITY

HMAC-SHA1 hash

20

Consent Freshness Check

10

Consent Freshness Check

Ensures peer is still reachable and consenting to receive traffic

~60100

Message Type

STUN Binding Request

2

Message Length

Length of message body

2

Magic Cookie

Fixed value to identify STUN

4

Transaction ID

Unique ID for matching responses

12

USERNAME

ICE username fragment

~1030

MESSAGE-INTEGRITY

HMAC-SHA1 hash for authentication

20

FINGERPRINT

CRC32 checksum for message integrity

4

sno

Use Case

Description

1

WebRTC Communication

Enables peer-to-peer audio/video/data streaming in browsers and apps.

2

VoIP Calls

Facilitates NAT traversal for SIP-based voice and video calls.

3

Online Gaming

Helps establish direct connections between players for real-time gameplay.

4

Remote Desktop Access

Allows secure and efficient peer-to-peer remote control sessions.

5

IoT Device Communication

Enables smart devices to connect directly across networks.

6

Video Conferencing Platforms

Ensures reliable media delivery across firewalls and NATs.

7

Enterprise Collaboration Tools

Supports real-time messaging and file sharing with direct connectivity.

8

Telehealth Applications

Enables secure video consultations between patients and providers.

9

Virtual Classrooms

Supports real-time interaction between students and teachers.

10

Live Streaming Services

Optimizes media routing for low-latency delivery.

Sno

Feature

Description

1

Candidate Gathering

Collects IP addresses and ports from local, STUN, and TURN sources.

2

Candidate Prioritization

Assigns priority values to candidates to choose the best path.

3

Candidate Pairing

Forms pairs of local and remote candidates for connectivity testing.

4

Connectivity Checks

Uses STUN to test which candidate pairs can communicate.

5

Nomination

Selects the best working candidate pair for media/data transmission.

6

NAT Traversal

Enables communication between devices behind NATs and firewalls.

7

STUN Integration

Uses STUN protocol to discover public-facing IP addresses.

8

TURN Integration

Uses TURN servers to relay traffic when direct connection fails.

9

Consent Freshness

Periodically checks if the peer is still reachable and consenting.

10

Trickle ICE Support

Allows incremental candidate gathering and faster connection setup.

Candidate Gathering - Testcases

S.No

Test Case

Description

Expected Result

1

Trigger Gathering

Start gathering on offer creation

Gathering starts

2

STUN Server Reachability

STUN server is reachable

Server responds

3

STUN Server Unreachable

STUN server is unreachable

Fallback or error

4

TURN Server Reachability

TURN server is reachable

Relay candidate gathered

5

TURN Server Unreachable

TURN server is unreachable

Fallback or error

6

Host Candidate Gathering

Gather host candidates

Host candidates listed

7

Server Reflexive Candidate

Gather via STUN

Reflexive candidate listed

8

Relay Candidate

Gather via TURN

Relay candidate listed

9

IPv4 Candidate

Gather IPv4 address

IPv4 candidate listed

10

IPv6 Candidate

Gather IPv6 address

IPv6 candidate listed

11

UDP Candidate

Gather UDP candidate

UDP candidate listed

12

TCP Candidate

Gather TCP candidate

TCP candidate listed

13

Candidate Priority

Assign priority to candidates

Priority values assigned

14

Candidate Foundation

Assign foundation to candidates

Foundation values assigned

15

Candidate Component ID

Assign component ID

Component ID set

16

Candidate Gathering Timeout

Gathering exceeds time limit

Gathering stops

17

Max Candidate Limit

More than 20 candidates gathered

Only 20 sent

18

Duplicate Candidate Filtering

Duplicate candidates gathered

Duplicates removed

19

Gathering Complete Event

All candidates gathered

Event triggered

20

Gathering Cancelled

Gathering interrupted

Process stops

21

Gathering Restart

ICE restart triggered

New gathering starts

22

Gathering on Answer

Answerer starts gathering

Candidates gathered

23

Gathering with Trickle ICE

Trickle ICE enabled

Candidates sent incrementally

24

Gathering without Trickle ICE

Trickle ICE disabled

All candidates sent at once

25

Gathering with VPN

VPN active

VPN IPs gathered

26

Gathering with Multiple Interfaces

Multiple NICs

Candidates from all interfaces

27

Gathering with NAT

Behind NAT

Reflexive candidates gathered

28

Gathering with Firewall

Firewall blocks ports

Limited candidates

29

Gathering with Proxy

Proxy in use

Relay candidates gathered

30

Gathering with IPv6 Only

No IPv4

Only IPv6 candidates

31

Gathering with IPv4 Only

No IPv6

Only IPv4 candidates

32

Gathering with No Network

No connectivity

No candidates gathered

33

Gathering with Mobile Network

Mobile data

Mobile IPs gathered

34

Gathering with Wi-Fi

Wi-Fi connected

Wi-Fi IPs gathered

35

Gathering with Ethernet

Ethernet connected

Ethernet IPs gathered

36

Gathering with DNS Failure

DNS resolution fails

STUN/TURN fails

37

Gathering with Invalid STUN

Invalid STUN config

Error or fallback

38

Gathering with Invalid TURN

Invalid TURN config

Error or fallback

39

Gathering with Auth Failure

TURN auth fails

No relay candidate

40

Gathering with ICE Lite

ICE Lite mode

Only host candidates

41

Gathering with ICE Full

Full ICE mode

All types gathered

42

Gathering with Bundle

Media bundled

Shared candidates

43

Gathering with RTCP Mux

RTCP multiplexed

Single component

44

Gathering with Simulcast

Multiple encodings

Candidates reused

45

Gathering with Data Channel

Data channel created

Candidates gathered

46

Gathering with Media Stream

Audio/video stream

Candidates gathered

47

Gathering with End-of-Candidates

End-of-candidates sent

Remote notified

48

Gathering with ICE Candidate Pairing

Candidates paired

Valid pairs formed

49

Gathering with Logging Enabled

Logging active

Logs show gathering steps

50

Gathering with Error Handling

Unexpected error

Error logged and handled

Candidate Prioritization - Testcases

S.No

Test Case

Description

Expected Result

1

Priority Calculation

Calculate priority using formula

Correct priority value

2

Host Candidate Priority

Assign priority to host candidate

Priority reflects host type

3

Server Reflexive Priority

Assign priority to reflexive candidate

Priority reflects reflexive type

4

Relay Candidate Priority

Assign priority to relay candidate

Priority reflects relay type

5

UDP Candidate Priority

Assign priority to UDP candidate

Higher than TCP

6

TCP Candidate Priority

Assign priority to TCP candidate

Lower than UDP

7

IPv4 vs IPv6 Priority

Compare IPv4 and IPv6 priorities

Correct preference applied

8

Component ID Impact

Component ID affects priority

Lower ID = higher priority

9

Foundation Impact

Foundation does not affect priority

Priority unaffected

10

Interface Preference

Prefer Ethernet over Wi-Fi

Ethernet has higher priority

11

VPN Interface Priority

VPN interface has lower priority

VPN deprioritized

12

NAT Type Impact

Symmetric NAT lowers priority

Correctly deprioritized

13

Priority Tie

Two candidates with same priority

Tie-breaking logic applied

14

Priority Sorting

Sort candidates by priority

Sorted descending

15

Priority Update

Update priority dynamically

New value applied

16

Priority Overflow

Priority exceeds max value

Capped or error

17

Priority Underflow

Priority below min value

Capped or error

18

Invalid Priority Value

Negative or invalid input

Error or ignored

19

Priority Logging

Log priority values

Values logged correctly

20

Priority in Trickle ICE

Trickle candidates prioritized

Correct order maintained

21

Priority in ICE Restart

Priorities recalculated

New values assigned

22

Priority with Bundle

Shared transport prioritization

Correct candidate selected

23

Priority with RTCP Mux

Single component prioritized

Correct priority used

24

Priority with Simulcast

Multiple encodings

Priorities reused

25

Priority with Data Channel

Data channel candidate prioritized

Correct order

26

Priority with Media Stream

Audio/video prioritized

Correct order

27

Priority with TURN Auth Failure

Relay candidate not prioritized

Removed or deprioritized

28

Priority with STUN Timeout

Reflexive candidate missing

Host prioritized

29

Priority with No Network

No candidates

No prioritization

30

Priority with Multiple Interfaces

Multiple NICs

All prioritized

31

Priority with Mobile Network

Mobile IP deprioritized

Lower priority

32

Priority with Wi-Fi

Wi-Fi IP prioritized over mobile

Correct order

33

Priority with Ethernet

Ethernet IP prioritized

Highest priority

34

Priority with Proxy

Relay candidate prioritized

Correct order

35

Priority with ICE Lite

Only host candidates prioritized

Correct order

36

Priority with ICE Full

All types prioritized

Correct order

37

Priority with Firewall

Limited candidates

Prioritization applied

38

Priority with DNS Failure

STUN/TURN fails

Host prioritized

39

Priority with Invalid STUN

Reflexive missing

Host prioritized

40

Priority with Invalid TURN

Relay missing

Reflexive prioritized

41

Priority with Auth Failure

TURN auth fails

Relay deprioritized

42

Priority with End-of-Candidates

Prioritization complete

Final order used

43

Priority with Pairing

Candidate pairs formed

Highest priority pair selected

44

Priority with ICE Nomination

Highest priority nominated

Correct candidate used

45

Priority with Role Conflict

Conflict resolved

Priority unaffected

46

Priority with Logging Enabled

Priorities logged

Logs show correct values

47

Priority with Error Handling

Invalid priority handled

Error logged

48

Priority with Manual Override

Manual priority set

Override applied

49

Priority with Custom Algorithm

Custom logic used

Correct values

50

Priority with RFC Compliance

Follows RFC 5245/8838

Standards met

Candidate Pairing - Testcases

S.No

Test Case

Description

Expected Result

1

Basic Pairing

Pair local and remote candidates

Valid pairs created

2

Host-Host Pairing

Pair two host candidates

Pair formed

3

Host-Reflexive Pairing

Host with reflexive

Pair formed

4

Host-Relay Pairing

Host with relay

Pair formed

5

Reflexive-Relay Pairing

Reflexive with relay

Pair formed

6

Relay-Relay Pairing

Relay with relay

Pair formed

7

Pairing with Different Components

Audio and video components

Separate pairs formed

8

Pairing with Same Foundation

Same foundation candidates

Pairs formed

9

Pairing with Different Foundations

Different foundations

Pairs formed

10

Pairing with Same Priority

Equal priority candidates

Tie-breaking applied

11

Pairing with Different Priorities

Higher priority preferred

Correct order

12

Pairing with Trickle ICE

Incremental candidates

Pairs updated dynamically

13

Pairing with ICE Restart

New candidates

Old pairs replaced

14

Pairing with Bundle

Shared transport

Single pair per component

15

Pairing with RTCP Mux

RTCP multiplexed

Single pair used

16

Pairing with Simulcast

Multiple encodings

Pairs reused

17

Pairing with Data Channel

Data channel candidates

Pairs formed

18

Pairing with Media Stream

Audio/video candidates

Pairs formed

19

Pairing with No Remote Candidates

Only local candidates

No pairs formed

20

Pairing with No Local Candidates

Only remote candidates

No pairs formed

21

Pairing with No Candidates

No candidates at all

No pairs formed

22

Pairing with NAT

NAT traversal candidates

Valid pairs formed

23

Pairing with Firewall

Limited connectivity

Fewer pairs formed

24

Pairing with VPN

VPN IPs

Pairs formed

25

Pairing with Multiple Interfaces

Multiple NICs

More pairs formed

26

Pairing with IPv6

IPv6 candidates

Pairs formed

27

Pairing with IPv4

IPv4 candidates

Pairs formed

28

Pairing with Mixed IP Versions

IPv4 and IPv6

Pairs formed if compatible

29

Pairing with UDP

UDP candidates

Pairs formed

30

Pairing with TCP

TCP candidates

Pairs formed

31

Pairing with Invalid Candidate

Malformed candidate

Ignored or error

32

Pairing with Duplicate Candidates

Duplicate entries

Duplicates filtered

33

Pairing with Priority Sorting

Sort pairs by priority

Correct order

34

Pairing with Connectivity Checks

STUN checks initiated

Valid pairs confirmed

35

Pairing with Failed Checks

STUN check fails

Pair marked failed

36

Pairing with Successful Checks

STUN check succeeds

Pair nominated

37

Pairing with Nomination

Best pair nominated

Used for media

38

Pairing with Role Conflict

Conflict resolved

Pairing continues

39

Pairing with ICE Lite

One side ICE Lite

Only controlling side pairs

40

Pairing with ICE Full

Both sides full ICE

Full pairing

41

Pairing with End-of-Candidates

No more candidates

Final pairs formed

42

Pairing with Logging Enabled

Logging active

Pairs logged

43

Pairing with Error Handling

Unexpected error

Logged and handled

44

Pairing with Manual Override

Manual pair selection

Used as nominated pair

45

Pairing with Custom Algorithm

Custom pairing logic

Pairs formed accordingly

46

Pairing with STUN Timeout

STUN server unresponsive

Pair fails

47

Pairing with TURN Timeout

TURN server unresponsive

Relay pair fails

48

Pairing with ICE Nomination Delay

Delay in nomination

Pair eventually nominated

49

Pairing with Changing Network

Network switch

New pairs formed

50

Pairing with RFC Compliance

Follows RFC 5245/8838

Standards met

Connectivity Checks - Testcases

S.No

Test Case

Description

Expected Result

1

Basic STUN Check

Perform STUN binding request

Response received

2

STUN Check Success

Valid candidate pair

Check succeeds

3

STUN Check Failure

Invalid candidate pair

Check fails

4

Check with Host Pair

Host-to-host pair

Check succeeds

5

Check with Reflexive Pair

Host-to-reflexive pair

Check succeeds

6

Check with Relay Pair

Host-to-relay pair

Check succeeds

7

Check with Mixed IP Versions

IPv4 to IPv6

Check fails or skipped

8

Check with Same IP Version

IPv4 to IPv4

Check succeeds

9

Check with UDP

UDP candidate pair

Check succeeds

10

Check with TCP

TCP candidate pair

Check succeeds

11

Check with NAT

NAT traversal required

Check succeeds via reflexive

12

Check with Firewall

Firewall blocks port

Check fails

13

Check with VPN

VPN IPs used

Check succeeds

14

Check with Multiple Interfaces

Multiple NICs

All pairs checked

15

Check with Trickle ICE

Incremental candidates

Checks triggered dynamically

16

Check with ICE Restart

New candidates

New checks initiated

17

Check with ICE Lite

One side ICE Lite

Full side initiates checks

18

Check with ICE Full

Both sides full ICE

Both perform checks

19

Check with Role Conflict

Conflict in controlling role

Resolved and checks continue

20

Check with Role Resolution

Tie-breaker used

One side becomes controlling

21

Check with Nomination

Successful pair nominated

Media path selected

22

Check with Early Nomination

Nomination before success

Ignored or delayed

23

Check with End-of-Candidates

No more candidates

Final checks performed

24

Check with Bundle

Shared transport

Single check per bundle

25

Check with RTCP Mux

RTCP multiplexed

Single check used

26

Check with Simulcast

Multiple encodings

Shared checks

27

Check with Data Channel

Data channel candidate

Check succeeds

28

Check with Media Stream

Audio/video stream

Check succeeds

29

Check with Timeout

STUN response delayed

Check fails

30

Check with Retransmissions

STUN retries

Retries sent

31

Check with Max Retries

Max retries reached

Check fails

32

Check with Priority Sorting

Higher priority first

Order followed

33

Check with Pair Pruning

Failed pairs removed

Only valid pairs retained

34

Check with Logging Enabled

Logging active

Check results logged

35

Check with Error Handling

Unexpected error

Logged and handled

36

Check with Invalid STUN Response

Malformed response

Check fails

37

Check with STUN Server Unreachable

No response

Check fails

38

Check with TURN Server

Relay pair check

Check succeeds

39

Check with TURN Auth Failure

Relay not usable

Check fails

40

Check with DNS Failure

STUN/TURN resolution fails

Check fails

41

Check with Changing Network

Network switch

New checks triggered

42

Check with Duplicate Candidates

Duplicate pairs

Duplicates ignored

43

Check with Manual Trigger

Manual check initiation

Check performed

44

Check with Custom Nomination

Custom logic used

Correct pair nominated

45

Check with RFC Compliance

Follows RFC 5245/8838

Standards met

46

Check with ICE Candidate Pairing

Valid pairs formed

Checks initiated

47

Check with STUN Binding Error

Error code returned

Check fails

48

Check with STUN Username Mismatch

Auth mismatch

Check fails

49

Check with STUN Integrity Check

Message integrity fails

Check fails

50

Check with Successful Connectivity

Best pair selected

Media flows

Nomination - Testcases

S.No

Test Case

Description

Expected Result

1

Basic Nomination

Nominate a successful candidate pair

Pair selected for media

2

Nomination After Success

Nominate only after successful check

Correct behavior

3

Early Nomination

Nominate before check success

Nomination ignored

4

Nomination with Highest Priority

Highest priority pair nominated

Correct pair used

5

Nomination with Lower Priority

Lower priority pair nominated manually

Manual override accepted

6

Nomination with Trickle ICE

Nominate trickled candidate

Nomination succeeds

7

Nomination with ICE Restart

Restart ICE and re-nominate

New pair nominated

8

Nomination with ICE Lite

Full ICE nominates

ICE Lite accepts

9

Nomination with ICE Full

Both sides full ICE

Controlling side nominates

10

Nomination with Role Conflict

Conflict resolved

Nomination proceeds

11

Nomination with Role Resolution

Tie-breaker used

Nomination proceeds

12

Nomination with Bundle

Shared transport

One pair nominated

13

Nomination with RTCP Mux

RTCP multiplexed

One pair nominated

14

Nomination with Simulcast

Multiple encodings

Shared nomination

15

Nomination with Data Channel

Data channel pair nominated

Media flows

16

Nomination with Media Stream

Audio/video pair nominated

Media flows

17

Nomination with Relay Pair

Relay candidate nominated

Media routed via TURN

18

Nomination with Reflexive Pair

Reflexive candidate nominated

Media routed via NAT

19

Nomination with Host Pair

Host candidate nominated

Direct media path

20

Nomination with Failed Pair

Nominate failed pair

Nomination rejected

21

Nomination with Duplicate Pair

Duplicate pair nominated

One accepted

22

Nomination with No Candidates

No valid pairs

Nomination fails

23

Nomination with Timeout

Nomination delayed

Fallback or retry

24

Nomination with Logging Enabled

Logging active

Nomination logged

25

Nomination with Error Handling

Unexpected error

Logged and handled

26

Nomination with Manual Trigger

Manual nomination

Pair accepted

27

Nomination with Automatic Trigger

Auto-nomination after check

Pair accepted

28

Nomination with Changing Network

Network switch

New pair nominated

29

Nomination with STUN Failure

STUN fails

Relay pair nominated

30

Nomination with TURN Failure

TURN fails

Reflexive or host nominated

31

Nomination with DNS Failure

STUN/TURN resolution fails

Host pair nominated

32

Nomination with IPv6

IPv6 pair nominated

Media flows

33

Nomination with IPv4

IPv4 pair nominated

Media flows

34

Nomination with Mixed IP Versions

Mixed IPs

Compatible pair nominated

35

Nomination with UDP

UDP pair nominated

Media flows

36

Nomination with TCP

TCP pair nominated

Media flows

37

Nomination with STUN Integrity Failure

Integrity check fails

Nomination fails

38

Nomination with Username Mismatch

STUN username mismatch

Nomination fails

39

Nomination with ICE Candidate Pairing

Valid pair nominated

Media flows

40

Nomination with End-of-Candidates

All candidates gathered

Final pair nominated

41

Nomination with Priority Tie

Equal priority pairs

Tie-breaking logic used

42

Nomination with Max Retries

STUN retries exhausted

Nomination fails

43

Nomination with Custom Algorithm

Custom logic used

Pair nominated

44

Nomination with RFC Compliance

Follows RFC 5245/8838

Standards met

45

Nomination with Multiple Media Lines

Multiple m-lines

Each line nominated

46

Nomination with ICE Checklist

Checklist completed

Best pair nominated

47

Nomination with STUN Retransmissions

Retries succeed

Pair nominated

48

Nomination with Delayed Response

STUN response delayed

Nomination waits

49

Nomination with Peer Reflexive Candidate

Peer reflexive pair nominated

Media flows

50

Nomination with Nomination Flag

Nomination flag set in STUN

Pair accepted

NAT Traversal - Testcases

S.No

Test Case

Description

Expected Result

1

Basic NAT Traversal

Peer behind NAT

Reflexive candidate discovered

2

Full Cone NAT

STUN request from full cone NAT

Public IP discovered

3

Restricted Cone NAT

STUN request from restricted NAT

Public IP discovered

4

Port Restricted NAT

STUN request from port-restricted NAT

Public IP discovered

5

Symmetric NAT

STUN request from symmetric NAT

Unique public IP per destination

6

NAT with STUN Server

STUN server reachable

Reflexive candidate gathered

7

NAT with TURN Server

TURN server reachable

Relay candidate gathered

8

NAT with STUN Timeout

STUN server unreachable

Fallback to host or TURN

9

NAT with TURN Timeout

TURN server unreachable

Fallback to STUN or host

10

NAT with No Server

No STUN/TURN available

Only host candidates

11

NAT with Multiple Interfaces

NAT on one interface

Reflexive from that interface

12

NAT with IPv6

NAT not used

Host candidate used

13

NAT with IPv4

NAT traversal required

Reflexive or relay used

14

NAT with UDP

UDP candidate behind NAT

STUN succeeds

15

NAT with TCP

TCP candidate behind NAT

TURN required

16

NAT with VPN

VPN IP behind NAT

VPN IP discovered

17

NAT with Firewall

NAT + firewall

Relay candidate used

18

NAT with Hairpinning Support

NAT supports hairpinning

Direct communication possible

19

NAT without Hairpinning

NAT blocks hairpinning

Relay used

20

NAT with Symmetric Response

Different IP/port per destination

Relay preferred

21

NAT with STUN Binding Success

STUN binding request succeeds

Reflexive candidate valid

22

NAT with STUN Binding Failure

STUN binding request fails

Candidate discarded

23

NAT with STUN Retries

STUN retries triggered

Retry succeeds or fails

24

NAT with STUN Authentication

STUN with credentials

Authenticated successfully

25

NAT with TURN Authentication

TURN with credentials

Relay candidate gathered

26

NAT with TURN Allocation Failure

TURN allocation fails

Relay not used

27

NAT with TURN Allocation Success

TURN allocation succeeds

Relay candidate used

28

NAT with ICE Lite Peer

Full ICE behind NAT

Reflexive or relay used

29

NAT with ICE Full Peer

Both behind NAT

Relay or reflexive used

30

NAT with Trickle ICE

Candidates trickled

NAT traversal continues dynamically

31

NAT with ICE Restart

Network change

New reflexive/relay gathered

32

NAT with Role Conflict

Conflict resolved

NAT traversal continues

33

NAT with Bundle

Shared transport

NAT traversal per bundle

34

NAT with RTCP Mux

Single component

NAT traversal once

35

NAT with Simulcast

Multiple encodings

Shared NAT traversal

36

NAT with Data Channel

Data channel behind NAT

Relay or reflexive used

37

NAT with Media Stream

Audio/video behind NAT

NAT traversal successful

38

NAT with Peer Reflexive Candidate

Peer reflexive discovered

Used for media

39

NAT with Changing IP

IP changes mid-session

ICE restart triggered

40

NAT with Changing Port

Port changes mid-session

ICE restart triggered

41

NAT with Logging Enabled

Logs enabled

NAT traversal steps logged

42

NAT with Error Handling

Unexpected error

Logged and handled

43

NAT with Manual Override

Manual candidate used

NAT traversal bypassed

44

NAT with Custom Priority

Custom priority logic

Correct candidate selected

45

NAT with RFC Compliance

Follows RFC 5245/8838

Standards met

46

NAT with End-of-Candidates

All candidates gathered

NAT traversal complete

47

NAT with Connectivity Checks

STUN checks succeed

NAT traversal confirmed

48

NAT with Nomination

Best NAT-traversed pair nominated

Media flows

49

NAT with STUN Username Mismatch

Auth fails

STUN check fails

50

NAT with STUN Integrity Failure

Message integrity fails

Candidate rejected

STUN Integration - Testcases

S.No

Test Case

Description

Expected Result

1

Basic STUN Request

Send STUN binding request

STUN response received

2

STUN Server Reachable

STUN server is online

Reflexive candidate gathered

3

STUN Server Unreachable

STUN server is offline

Error or fallback

4

STUN with Valid Credentials

Authenticated request

Response accepted

5

STUN with Invalid Credentials

Wrong username/password

Request rejected

6

STUN with No Credentials

Anonymous request

Response accepted (if allowed)

7

STUN Binding Success

Valid request

Public IP and port returned

8

STUN Binding Failure

Malformed request

Error response

9

STUN with UDP

Request over UDP

Response received

10

STUN with TCP

Request over TCP

Response received

11

STUN with IPv4

IPv4 address used

Reflexive candidate returned

12

STUN with IPv6

IPv6 address used

Reflexive candidate returned

13

STUN with NAT

Behind NAT

Public IP discovered

14

STUN with Symmetric NAT

Symmetric NAT behavior

Unique IP/port per destination

15

STUN with Full Cone NAT

Full cone NAT behavior

Same IP/port for all

16

STUN with Port Restricted NAT

Port restrictions applied

Limited response

17

STUN with Firewall

Firewall blocks STUN

Request fails

18

STUN with VPN

VPN IP used

VPN public IP returned

19

STUN with Multiple Interfaces

Multiple NICs

Multiple reflexive candidates

20

STUN with DNS Resolution

STUN server via DNS

Resolved and contacted

21

STUN with DNS Failure

DNS fails

STUN request fails

22

STUN with Timeout

No response in time

Retry or fail

23

STUN with Retransmissions

Retry logic triggered

Response eventually received

24

STUN with Max Retries

Max retries reached

Request fails

25

STUN with Logging Enabled

Logging active

Request/response logged

26

STUN with Error Handling

Unexpected error

Logged and handled

27

STUN with Message Integrity

Integrity check passed

Request accepted

28

STUN with Integrity Failure

Integrity check failed

Request rejected

29

STUN with Fingerprint

Fingerprint attribute used

Validated successfully

30

STUN with Invalid Fingerprint

Fingerprint mismatch

Request rejected

31

STUN with ICE Full

Full ICE mode

STUN used for reflexive candidates

32

STUN with ICE Lite

ICE Lite mode

STUN not used

33

STUN with Trickle ICE

Trickle candidates

STUN used incrementally

34

STUN with ICE Restart

ICE restart triggered

New STUN requests sent

35

STUN with Bundle

Shared transport

STUN used once

36

STUN with RTCP Mux

RTCP multiplexed

STUN used once

37

STUN with Simulcast

Multiple encodings

Shared STUN usage

38

STUN with Data Channel

Data channel candidate

STUN used

39

STUN with Media Stream

Audio/video stream

STUN used

40

STUN with Peer Reflexive Discovery

Peer reflexive candidate found

Added to checklist

41

STUN with Role Conflict

Conflict resolved

STUN continues

42

STUN with Role Resolution

Tie-breaker used

STUN proceeds

43

STUN with Connectivity Checks

STUN used for checks

Validated pairs

44

STUN with Nomination

STUN confirms nominated pair

Media flows

45

STUN with End-of-Candidates

All candidates gathered

STUN stops

46

STUN with Invalid Response

Malformed STUN response

Ignored or logged

47

STUN with Server Overload

STUN server busy

Retry or fallback

48

STUN with Custom Server

Custom STUN server used

Response received

49

STUN with RFC Compliance

Follows RFC 5389

Standards met

50

STUN with Security Audit

STUN traffic inspected

Secure and valid

TURN Integration - Testcases

S.No

Test Case

Description

Expected Result

1

Basic TURN Allocation

Allocate relay address

Relay candidate gathered

2

TURN Server Reachable

TURN server is online

Allocation succeeds

3

TURN Server Unreachable

TURN server is offline

Allocation fails

4

TURN with Valid Credentials

Authenticated request

Allocation succeeds

5

TURN with Invalid Credentials

Wrong username/password

Allocation rejected

6

TURN with No Credentials

Anonymous request

Allocation fails

7

TURN with UDP Transport

Allocate over UDP

Relay candidate returned

8

TURN with TCP Transport

Allocate over TCP

Relay candidate returned

9

TURN with TLS Transport

Allocate over TLS

Relay candidate returned

10

TURN with IPv4

IPv4 relay address

Candidate gathered

11

TURN with IPv6

IPv6 relay address

Candidate gathered

12

TURN with NAT

Behind NAT

Relay candidate used

13

TURN with Symmetric NAT

Symmetric NAT present

Relay candidate used

14

TURN with Firewall

Firewall blocks STUN

Relay used as fallback

15

TURN with VPN

VPN IP used

Relay candidate gathered

16

TURN with Multiple Interfaces

Multiple NICs

Relay for each interface

17

TURN with DNS Resolution

TURN server via DNS

Resolved and contacted

18

TURN with DNS Failure

DNS fails

TURN request fails

19

TURN with Timeout

No response in time

Retry or fail

20

TURN with Retransmissions

Retry logic triggered

Allocation succeeds

21

TURN with Max Retries

Max retries reached

Allocation fails

22

TURN with Logging Enabled

Logging active

Request/response logged

23

TURN with Error Handling

Unexpected error

Logged and handled

24

TURN with Message Integrity

Integrity check passed

Request accepted

25

TURN with Integrity Failure

Integrity check failed

Request rejected

26

TURN with Fingerprint

Fingerprint attribute used

Validated successfully

27

TURN with Invalid Fingerprint

Fingerprint mismatch

Request rejected

28

TURN with ICE Full

Full ICE mode

Relay candidate used

29

TURN with ICE Lite

ICE Lite mode

Relay not used

30

TURN with Trickle ICE

Trickle candidates

Relay trickled

31

TURN with ICE Restart

ICE restart triggered

New relay candidate gathered

32

TURN with Bundle

Shared transport

One relay candidate used

33

TURN with RTCP Mux

RTCP multiplexed

One relay candidate used

34

TURN with Simulcast

Multiple encodings

Shared relay

35

TURN with Data Channel

Data channel candidate

Relay used

36

TURN with Media Stream

Audio/video stream

Relay used

37

TURN with Peer Reflexive Discovery

Peer reflexive fails

Relay used

38

TURN with Changing IP

IP changes mid-session

New relay allocated

39

TURN with Changing Port

Port changes mid-session

New relay allocated

40

TURN with Allocation Refresh

Refresh allocation

Allocation extended

41

TURN with Allocation Expiry

Allocation expires

Media path fails

42

TURN with Permission Creation

Create permission for peer

Permission accepted

43

TURN with Channel Binding

Bind channel to peer

Channel bound successfully

44

TURN with Channel Data

Send data via channel

Data delivered

45

TURN with CreatePermission Failure

Permission denied

Data blocked

46

TURN with ChannelBind Failure

Channel binding fails

Fallback to Send/Recv

47

TURN with RFC Compliance

Follows RFC 5766

Standards met

48

TURN with Server Overload

TURN server busy

Retry or fallback

49

TURN with Custom Server

Custom TURN server used

Allocation succeeds

50

TURN with Security Audit

TURN traffic inspected

Secure and valid

Consent Freshness - Testcases

S.No

Test Case

Description

Expected Result

1

Basic Consent Check

Send periodic STUN request

Response received

2

Consent Check Success

Valid response received

Consent maintained

3

Consent Check Failure

No response

Consent expired

4

Consent Timer Expiry

Timer exceeds threshold

Consent revoked

5

Consent Refresh Interval

Refresh every 30 seconds

Consent remains valid

6

Consent with STUN Success

STUN binding response OK

Consent refreshed

7

Consent with STUN Failure

STUN binding fails

Consent lost

8

Consent with NAT

Behind NAT

Consent maintained via reflexive

9

Consent with Relay

Using TURN relay

Consent maintained

10

Consent with Host Candidate

Direct host candidate

Consent maintained

11

Consent with Peer Reflexive

Peer reflexive candidate

Consent maintained

12

Consent with Trickle ICE

Trickle candidate used

Consent refreshed

13

Consent with ICE Restart

ICE restarted

Consent re-established

14

Consent with ICE Lite

ICE Lite peer

Full ICE maintains consent

15

Consent with ICE Full

Both peers full ICE

Consent maintained

16

Consent with Bundle

Shared transport

Consent checked once

17

Consent with RTCP Mux

RTCP multiplexed

Consent checked once

18

Consent with Simulcast

Multiple encodings

Shared consent check

19

Consent with Data Channel

Data channel active

Consent maintained

20

Consent with Media Stream

Audio/video stream

Consent maintained

21

Consent with Timeout

No response in time

Consent lost

22

Consent with Retransmissions

Retry on failure

Consent restored

23

Consent with Max Retries

Retries exhausted

Consent revoked

24

Consent with Logging Enabled

Logging active

Consent events logged

25

Consent with Error Handling

Unexpected error

Logged and handled

26

Consent with Invalid STUN Response

Malformed response

Consent not refreshed

27

Consent with STUN Integrity Failure

Integrity check fails

Consent not refreshed

28

Consent with Username Mismatch

STUN auth fails

Consent not refreshed

29

Consent with Changing IP

IP changes mid-session

Consent re-established

30

Consent with Changing Port

Port changes mid-session

Consent re-established

31

Consent with Firewall

Firewall blocks STUN

Consent lost

32

Consent with VPN

VPN IP used

Consent maintained

33

Consent with IPv4

IPv4 candidate

Consent maintained

34

Consent with IPv6

IPv6 candidate

Consent maintained

35

Consent with UDP

UDP transport

Consent maintained

36

Consent with TCP

TCP transport

Consent maintained

37

Consent with STUN Server Overload

Server busy

Consent may fail

38

Consent with Custom Interval

Custom refresh interval

Consent maintained

39

Consent with Manual Trigger

Manual STUN request

Consent refreshed

40

Consent with Automatic Trigger

Timer-based STUN request

Consent refreshed

41

Consent with End-of-Candidates

All gathered

Consent checks begin

42

Consent with Nomination

Nominated pair

Consent maintained

43

Consent with Role Conflict

Conflict resolved

Consent checks continue

44

Consent with Role Resolution

Tie-breaker used

Consent checks continue

45

Consent with RFC Compliance

Follows RFC 7675

Standards met

46

Consent with Peer Disconnection

Peer goes offline

Consent fails

47

Consent with Network Switch

Network changes

Consent re-established

48

Consent with STUN Server Change

New server used

Consent maintained

49

Consent with Security Audit

STUN traffic inspected

Secure and valid

50

Consent with Consent Expiry Handling

Consent lost

Media transmission stopped

Trickle ICE Support - Testcases

S.No

Test Case

Description

Expected Result

1

Basic Trickle ICE

Enable trickle ICE

Candidates sent incrementally

2

Trickle ICE Enabled in Offer

Offer includes trickle support

Remote peer accepts trickle

3

Trickle ICE Disabled in Offer

Offer disables trickle

All candidates sent at once

4

Trickle ICE Enabled in Answer

Answer includes trickle support

Trickle ICE proceeds

5

Trickle ICE Disabled in Answer

Answer disables trickle

Trickle ICE not used

6

Trickle ICE with Host Candidates

Host candidates trickled

Sent after gathering

7

Trickle ICE with Reflexive Candidates

Reflexive candidates trickled

Sent after STUN response

8

Trickle ICE with Relay Candidates

Relay candidates trickled

Sent after TURN allocation

9

Trickle ICE with STUN Timeout

STUN delayed

Reflexive candidate trickled late

10

Trickle ICE with TURN Timeout

TURN delayed

Relay candidate trickled late

11

Trickle ICE with ICE Restart

ICE restart triggered

New trickle cycle begins

12

Trickle ICE with ICE Lite Peer

Full ICE trickles

ICE Lite accepts

13

Trickle ICE with ICE Full Peer

Both sides full ICE

Trickle ICE supported

14

Trickle ICE with Bundle

Shared transport

Trickle applies to all m-lines

15

Trickle ICE with RTCP Mux

RTCP multiplexed

Trickle applies once

16

Trickle ICE with Simulcast

Multiple encodings

Trickle applies to all

17

Trickle ICE with Data Channel

Data channel candidate trickled

Connection established

18

Trickle ICE with Media Stream

Audio/video candidate trickled

Media flows

19

Trickle ICE with End-of-Candidates

End-of-candidates sent

Trickle phase ends

20

Trickle ICE with No Candidates

No candidates gathered

End-of-candidates sent

21

Trickle ICE with Delayed Gathering

STUN/TURN delayed

Candidates trickled late

22

Trickle ICE with Logging Enabled

Logging active

Trickle events logged

23

Trickle ICE with Error Handling

Unexpected error

Logged and handled

24

Trickle ICE with Invalid Candidate

Malformed candidate trickled

Ignored or rejected

25

Trickle ICE with Duplicate Candidate

Duplicate trickled

Ignored

26

Trickle ICE with Manual Trigger

Manual candidate trickling

Candidate accepted

27

Trickle ICE with Automatic Trigger

Auto-trickling on discovery

Candidate accepted

28

Trickle ICE with Consent Checks

Consent maintained

Trickle ICE unaffected

29

Trickle ICE with Connectivity Checks

Checks triggered on trickle

Valid pairs tested

30

Trickle ICE with Nomination

Trickle candidate nominated

Used for media

31

Trickle ICE with Role Conflict

Conflict resolved

Trickle continues

32

Trickle ICE with Role Resolution

Tie-breaker used

Trickle continues

33

Trickle ICE with IPv4

IPv4 candidate trickled

Accepted

34

Trickle ICE with IPv6

IPv6 candidate trickled

Accepted

35

Trickle ICE with UDP

UDP candidate trickled

Accepted

36

Trickle ICE with TCP

TCP candidate trickled

Accepted

37

Trickle ICE with Peer Reflexive

Peer reflexive discovered

Added to checklist

38

Trickle ICE with Changing Network

Network switch

New candidates trickled

39

Trickle ICE with STUN Server Change

New STUN server used

New reflexive trickled

40

Trickle ICE with TURN Server Change

New TURN server used

New relay trickled

41

Trickle ICE with Custom Priority

Custom priority logic

Trickle order respected

42

Trickle ICE with RFC Compliance

Follows RFC 8838

Standards met

43

Trickle ICE with ICE Candidate Pairing

New pairs formed

Connectivity checks triggered

44

Trickle ICE with End-of-Candidates Missing

No end-of-candidates

ICE may hang

45

Trickle ICE with Early Media

Media before trickle completes

Partial media flow

46

Trickle ICE with STUN Integrity Failure

Integrity check fails

Candidate rejected

47

Trickle ICE with Username Mismatch

Auth fails

Candidate rejected

48

Trickle ICE with Security Audit

Trickle traffic inspected

Secure and valid

49

Trickle ICE with Server Overload

STUN/TURN overloaded

Trickle delayed

50

Trickle ICE with Peer Not Supporting Trickle

Peer ignores trickle

Fallback to full ICE

  • Reference links