private void doListen() {
    // listening port and create connection
    while(isActive()) {
      try {
        Socket socket = listener.accept();        
        if (socket != null) {
          // create connection
          ISocketServerConnection sc = new SocketServerConnection(socket, getNextIdConnection());

          boolean isAccept = fireAttemptClientConnect(new AttemptClientConnectEvent(this, sc));
          if (isAccept) {
            sc.addDisconnectListener(new DisconnectListener() {
              @Override
              public void OnDisconnectEvent(DisconnectEvent evt) {
                fireDisconnectEvent(evt);
              }
            });
            sc.addReceiveDataListener(new IReceiveDataListener() {
              @Override
              public void OnReceiveDataEvent(ReceiveDataEvent evt) {
                fireReceiveDataEvent(
                        new ReceiveDataOnServerEvent(this,
                                                     (ISocketServerConnection)evt.getSource(),
                                                     evt.getData()));
              }
            });
            sc.setReceiveException(new IReceiveException() {
              @Override
              public boolean OnReceiveExceptionEvent(ExceptionEvent evt) {
                return fireReceiveExceptionEvent(new ExceptionEvent(this, evt.getException()));
              }
            });

            sc.setIdleTimeout(idleTimeout);
            // calls enter in separated thread
            if (!sc.isActive()) sc.connect();
            // add connection to list
            getConnections().add(sc);
            // notify that client has been connected
            fireClientConnectEvent(new ConnectOnServerEvent(this, sc));
          }
          else {
            // not accept connection
            try {
              sc.disconnect();
            }
            finally {
              sc = null;
            }
          }
        }
      }
      catch(Exception e) {
        if (e instanceof SocketException) { // break line
          break;
        }

        Thread.yield();

        if (isActive()) fireServerExceptionEvent(new ExceptionEvent(this, e));
        //???
      }
    }
  }