package com.juick.xmpp.s2s; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * * @author ugnich */ public class ConnectionListener implements Runnable { ExecutorService executorService = Executors.newCachedThreadPool(); @Override public void run() { try { ServerSocket listener = new ServerSocket(5269); while (true) { Socket sock = listener.accept(); ConnectionIn conn = new ConnectionIn(sock); XMPPComponent.addConnectionIn(conn); executorService.submit(conn); } } catch (IOException e) { System.out.println("IOException on socket listen: " + e.toString()); } } }