public static void startListenerThread(final ServerSocket listenerSocket) throws IOException {
		new Thread(new Runnable() {
			public void run() {
				try {
					ArrayList<Socket> acceptedClientsList = new ArrayList<Socket>();
					try {
						while (true) {
							Socket socket = listenerSocket.accept();
							acceptedClientsList.add(socket);
							startClientThread(socket);
						}
					} catch (SocketException e) {
						for (int i = 0; i < acceptedClientsList.size(); i++) {
							acceptedClientsList.get(i).close();
						}
					} finally {
						listenerSocket.close();
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();
	}