diff --git a/src/main/java/org/ice4j/socket/DTLSDatagramFilter.java b/src/main/java/org/ice4j/socket/DTLSDatagramFilter.java index 763b1fd..b686733 100644 --- a/src/main/java/org/ice4j/socket/DTLSDatagramFilter.java +++ b/src/main/java/org/ice4j/socket/DTLSDatagramFilter.java @@ -20,7 +20,7 @@ package org.ice4j.socket; import java.net.*; /** - * A DatagramPacketFilter which accepts only DTLS packets. + * A {@code DatagramPacketFilter} which accepts DTLS packets only. * * @author Boris Grozev */ @@ -28,19 +28,22 @@ public class DTLSDatagramFilter implements DatagramPacketFilter { /** - * Returns true if p looks like a DTLS packet. - * @param p the DatagramPacket to check. - * @return trueif p looks like a DTLS packet. + * Determines whether {@code p} looks like a DTLS packet. + * + * @param p the {@code DatagramPacket} to check. + * @return {@code true} if {@code p} looks like a DTLS packet; otherwise, + * {@code false}. */ public static boolean isDTLS(DatagramPacket p) { - byte[] data = p.getData(); - int off = p.getOffset(); int len = p.getLength(); if (len > 0) { + byte[] data = p.getData(); + int off = p.getOffset(); int fb = data[off] & 0xff; + return 19 < fb && fb < 64; } diff --git a/src/main/java/org/ice4j/socket/MultiplexingSocket.java b/src/main/java/org/ice4j/socket/MultiplexingSocket.java index 362c2f5..7f896e9 100644 --- a/src/main/java/org/ice4j/socket/MultiplexingSocket.java +++ b/src/main/java/org/ice4j/socket/MultiplexingSocket.java @@ -125,10 +125,11 @@ public class MultiplexingSocket /** * Initializes a new MultiplexingSocket instance. * + * @param address not used + * @param port not used * @see Socket#Socket(InetAddress, int) */ public MultiplexingSocket(InetAddress address, int port) - throws IOException { this((Socket) null); } @@ -136,12 +137,15 @@ public class MultiplexingSocket /** * Initializes a new MultiplexingSocket instance. * + * @param address not used + * @param port not used + * @param localAddr not used + * @param localPort not used * @see Socket#Socket(InetAddress, int, InetAddress, int) */ public MultiplexingSocket( InetAddress address, int port, InetAddress localAddr, int localPort) - throws IOException { this((Socket) null); } @@ -149,6 +153,7 @@ public class MultiplexingSocket /** * Initializes a new MultiplexingSocket instance. * + * @param proxy not used * @see Socket#Socket(Proxy) */ public MultiplexingSocket(Proxy proxy) @@ -178,10 +183,10 @@ public class MultiplexingSocket /** * Initializes a new MultiplexingSocket instance. * + * @param impl not used * @see Socket#Socket(SocketImpl) */ protected MultiplexingSocket(SocketImpl impl) - throws SocketException { this((Socket) null); } @@ -189,10 +194,11 @@ public class MultiplexingSocket /** * Initializes a new MultiplexingSocket instance. * + * @param host not used + * @param port not used * @see Socket#Socket(String, int) */ public MultiplexingSocket(String host, int port) - throws UnknownHostException, IOException { this((Socket) null); } @@ -200,6 +206,10 @@ public class MultiplexingSocket /** * Initializes a new MultiplexingSocket instance. * + * @param host not used + * @param port not used + * @param localAddr not used + * @param localPort not used * @see Socket#Socket(String, int, InetAddress, int) */ public MultiplexingSocket( @@ -511,8 +521,8 @@ public class MultiplexingSocket } accepted = true; - // Emil: Don't break because we want all filtering - // sockets to get the received packet. + // Emil Ivov: Don't break because we want all + // filtering sockets to get the received packet. } } if (!accepted)