Source:
private int addRemoteCandidates( List<CandidatePacketExtension> candidates, boolean iceAgentStateIsRunning) { Collections.sort(candidates); int generation = iceAgent.getGeneration(); int remoteCandidateCount = 0; for (CandidatePacketExtension candidate : candidates) { if (candidate.getGeneration() != generation) continue; String address = candidate.getIP(); boolean needsResolution = !IPAddressUtil.isIPv4LiteralAddress(address) && !IPAddressUtil.isIPv6LiteralAddress(address); if (needsResolution && !Config.resolveRemoteCandidates()) { logger.debug(() -> "Ignoring remote candidate with non-literal address: " + address); continue; } Component component = iceStream.getComponent(candidate.getComponent()); String relAddr; int relPort; TransportAddress relatedAddress = null; if ((relAddr = candidate.getRelAddr()) != null && (relPort = candidate.getRelPort()) != -1) { boolean relAddrNeedsResolution = !IPAddressUtil.isIPv4LiteralAddress(relAddr) && !IPAddressUtil.isIPv6LiteralAddress(relAddr); if (relAddrNeedsResolution && !Config.resolveRemoteCandidates()) { logger.debug(() -> "Ignoring remote candidate with non-literal related address: " + address); continue; } relatedAddress = new TransportAddress( relAddr, relPort, Transport.parse(candidate.getProtocol())); } RemoteCandidate relatedCandidate = component.findRemoteCandidate(relatedAddress); RemoteCandidate remoteCandidate = new RemoteCandidate( new TransportAddress( candidate.getIP(), candidate.getPort(), Transport.parse(candidate.getProtocol())), component, org.ice4j.ice.CandidateType.parse( candidate.getType().toString()), candidate.getFoundation(), candidate.getPriority(), relatedCandidate); if (!TransportUtils.canReach(component, remoteCandidate)) { continue; } if (iceAgentStateIsRunning) { component.addUpdateRemoteCandidates(remoteCandidate); } else { component.addRemoteCandidate(remoteCandidate); } remoteCandidateCount++; } return remoteCandidateCount; }

Target:
private int addRemoteCandidates( List<CandidatePacketExtension> candidates, boolean iceAgentStateIsRunning) { Collections.sort(candidates); int generation = iceAgent.getGeneration(); int remoteCandidateCount = 0; for (CandidatePacketExtension candidate : candidates) { if (candidate.getGeneration() != generation) continue; String address = candidate.getIP(); boolean needsResolution = !IPAddressUtil.isIPv4LiteralAddress(address) && !IPAddressUtil.isIPv6LiteralAddress(address); if (needsResolution && !Config.resolveRemoteCandidates()) { logger.debug(() -> "Ignoring remote candidate with non-literal address: " + address); continue; } Component component = iceStream.getComponent(candidate.getComponent()); RemoteCandidate remoteCandidate = new RemoteCandidate( new TransportAddress( candidate.getIP(), candidate.getPort(), Transport.parse(candidate.getProtocol())), component, org.ice4j.ice.CandidateType.parse( candidate.getType().toString()), candidate.getFoundation(), candidate.getPriority(), null); if (!TransportUtils.canReach(component, remoteCandidate)) { continue; } if (iceAgentStateIsRunning) { component.addUpdateRemoteCandidates(remoteCandidate); } else { component.addRemoteCandidate(remoteCandidate); } remoteCandidateCount++; } return remoteCandidateCount; }