From a17d28605a9b6b8ef7eba3aae27df87404819cc5 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Sun, 16 Mar 2014 07:00:44 -0700 Subject: [PATCH] [#2326] Add constructor to NioServerSocketChannel which accepts a ServerSocketChannel Motivation: Allow the user to create a NioServerSocketChannel from an existing ServerSocketChannel. Modifications: Add an extra constructor Result: Now the user is be able to create a NioServerSocketChannel from an existing ServerSocketChannel, like he can do with all the other Nio*Channel implemntations. --- .../netty/channel/socket/nio/NioServerSocketChannel.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioServerSocketChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/NioServerSocketChannel.java index fc04d7a99b..3238201871 100644 --- a/transport/src/main/java/io/netty/channel/socket/nio/NioServerSocketChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/nio/NioServerSocketChannel.java @@ -66,7 +66,14 @@ public class NioServerSocketChannel extends AbstractNioMessageChannel * Create a new instance */ public NioServerSocketChannel() { - super(null, newSocket(), SelectionKey.OP_ACCEPT); + this(newSocket()); + } + + /** + * Create a new instance using the given {@link ServerSocketChannel}. + */ + public NioServerSocketChannel(ServerSocketChannel channel) { + super(null, channel, SelectionKey.OP_ACCEPT); config = new DefaultServerSocketChannelConfig(this, javaChannel().socket()); }