public Listener(String ports[], int bufferSize, int period, UnityIMPServer server) {
        this.period = period;
        this.server = server;
        this._codec = server.getObjKempCodec().getMessageCodec();
        this.objByteBufferPool = new ByteBufferPool(bufferSize,false);
        try {
            this.selector = Selector.open();
            channel = new ServerSocketChannel[ports.length];
            int i = 0;
            for (String port : ports) {

                this.channel[i] = ServerSocketChannel.open();
                this.channel[i].configureBlocking(false);
                this.channel[i].socket().bind(new InetSocketAddress(Integer.parseInt(port)));
                this.channel[i].register(this.selector, 16);

            }
        } catch (IOException e) {
            throw new RuntimeException("Could not register listener", e);
        } catch (NumberFormatException e) {
            throw e;
        }
    }