diff --git a/transport/src/main/java/io/netty/channel/socket/DatagramChannel.java b/transport/src/main/java/io/netty/channel/socket/DatagramChannel.java index d430a73524..7901d238d3 100644 --- a/transport/src/main/java/io/netty/channel/socket/DatagramChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/DatagramChannel.java @@ -35,6 +35,8 @@ public interface DatagramChannel extends Channel { @Override InetSocketAddress remoteAddress(); + boolean isConnected(); + /** * Joins a multicast group. */ diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java index 483b8b2fa9..19170c9093 100644 --- a/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java @@ -112,6 +112,11 @@ public final class NioDatagramChannel return ch.isOpen() && ch.socket().isBound(); } + @Override + public boolean isConnected() { + return javaChannel().isConnected(); + } + @Override protected DatagramChannel javaChannel() { return (DatagramChannel) super.javaChannel(); diff --git a/transport/src/main/java/io/netty/channel/socket/oio/OioDatagramChannel.java b/transport/src/main/java/io/netty/channel/socket/oio/OioDatagramChannel.java index 47da1e5462..9e53c57bfe 100644 --- a/transport/src/main/java/io/netty/channel/socket/oio/OioDatagramChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/oio/OioDatagramChannel.java @@ -109,6 +109,11 @@ public class OioDatagramChannel extends AbstractOioMessageChannel return isOpen() && socket.isBound(); } + @Override + public boolean isConnected() { + return socket.isConnected(); + } + @Override protected SocketAddress localAddress0() { return socket.getLocalSocketAddress();