
package com.esotericsoftware.kryonetty;

import java.net.InetSocketAddress;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;

/**
 * Skeleton Kryo server implementation using Netty.
 * @author Nathan Sweet
 */
public abstract class Server implements Endpoint {
	private ServerBootstrap bootstrap;

	public Server (int port) {
		ExecutorService threadPool = Executors.newCachedThreadPool();
		bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(threadPool, threadPool));
		bootstrap.setPipelineFactory(new KryoChannelPipelineFactory(this));
		bootstrap.setOption("child.tcpNoDelay", true);
		bootstrap.setOption("child.reuseAddress", true);
		bootstrap.bind(new InetSocketAddress(port));
	}
}

@@ -205,16 +205,56 @@
 tstrap;%0A
+import org.jboss.netty.channel.Channel;%0A
 import o
@@ -318,16 +318,16 @@
 actory;%0A
-
 %0A/**%0A * 
@@ -489,16 +489,42 @@
 otstrap;
+%0A%09private Channel channel;
 %0A%0A%09publi
@@ -867,32 +867,42 @@
 ress%22, true);%0A%09%09
+channel = 
 bootstrap.bind(n
@@ -932,11 +932,76 @@
 rt));%0A%09%7D
+%0A%0A%09public void close () %7B%0A%09%09channel.close();%0A%09%09channel = null;%0A%09%7D
 %0A%7D%0A

Add close method