}
public void setupNetwork() throws IOException {
validateConfig(config);
synchronized (listeners) {
AbstractMemoryManager amm = null;
for (final NetworkListener listener : config.getNetworkListeners().getNetworkListener()) {
final GenericGrizzlyListener grizzlyListener = new GenericGrizzlyListener();
grizzlyListener.configure(habitat, listener);
final MemoryManager mm = grizzlyListener.transport.getMemoryManager();
if (mm instanceof AbstractMemoryManager) {
amm = (AbstractMemoryManager) mm;
}
listeners.add(grizzlyListener);
final Thread thread = new DefaultWorkerThread(Grizzly.DEFAULT_ATTRIBUTE_BUILDER,
grizzlyListener.getName(),
amm != null ? amm.createThreadLocalPool() : null,
new ListenerRunnable(grizzlyListener));
thread.setDaemon(true);
thread.start();
}
try {