((SocketSessionConfig) config.getSessionConfig()).setReuseAddress(true);
acceptor.bind(new InetSocketAddress(ip, port), handler, config);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
acceptor.unbindAll();
}
});
return acceptor;
}