private void OnStartConnection(IAsyncResult ar)
        {
            try
            {
                var s = (Socket)ar.AsyncState;
                var incomingSocket = s.EndAccept(ar);
                var ea             = new IncomingConnectionEventArgs {
                    Socket = incomingSocket
                };
                OnIncomingConnection(ea);

                if (!ea.Handled)
                {
                    incomingSocket.Disconnect(false); // DisconnectAsync(new SocketAsyncEventArgs());
                }

                // continue accepting
                SetupConnection(s);
            }
            catch (ObjectDisposedException) { /* End has been called */ }
            catch (System.Net.Sockets.SocketException) {
                try
                {
                    var s = (Socket)ar.AsyncState;
                    SetupConnection(s);
                }
                catch { }
            }
        }
 private void OnIncomingConnection(IncomingConnectionEventArgs e)
 {
     if (IncomingConnection != null)
     {
         IncomingConnection(this, e);
     }
 }