Good find, we'll take a look.
should we use `array[i].equals(o)` ? imho this would be "safer".  Changed it to `Objects.equals` in line with the API spec recommendation – it handles `null` values correctly. Oh no, that's not available in the older Java versions. Fine.
Possible issues with SelectedSelectionKeySet in non-linux operating systems
`SelectedSelectionKeySet` doesn't implement `contains()` method. Or at least it returns always false. This may create issues in non-linux operating systems.

To give you more context, in my work, like you do, we try to not produce garbage by replacing `HashSet` with something similar to `SelectedSelectionKeySet`. Actually this trick is something we learned from netty.

So while investigating a recent bug, I realized lack of correct implementation of `contains()` method creates problems in macos (and very possibly windows as well). I tried to summarize my finding in here: https://github.com/hazelcast/hazelcast/pull/24267

I do think this issue effects netty as well.
transport/src/main/java/io/netty/channel/nio/SelectedSelectionKeySet.java
transport/src/main/java/io/netty/channel/nio/SelectedSelectionKeySet.java
transport/src/test/java/io/netty/channel/nio/SelectedSelectionKeySetTest.java
diff --git a/transport/src/main/java/io/netty/channel/nio/SelectedSelectionKeySet.java b/transport/src/main/java/io/netty/channel/nio/SelectedSelectionKeySet.java
index 7117b06029e..b9c72b635cd 100644
--- a/transport/src/main/java/io/netty/channel/nio/SelectedSelectionKeySet.java
+++ b/transport/src/main/java/io/netty/channel/nio/SelectedSelectionKeySet.java
@@ -20,6 +20,7 @@
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
+import java.util.Objects;
 
 final class SelectedSelectionKeySet extends AbstractSet<SelectionKey> {
 
@@ -51,6 +52,13 @@ public boolean remove(Object o) {
 
     @Override
     public boolean contains(Object o) {
+        SelectionKey[] array = keys;
+        for (int i = 0, s = size; i < s; i++) {
+            SelectionKey k = array[i];
+            if (k.equals(o)) {
+                return true;
+            }
+        }
         return false;
     }
 

diff --git a/transport/src/test/java/io/netty/channel/nio/SelectedSelectionKeySetTest.java b/transport/src/test/java/io/netty/channel/nio/SelectedSelectionKeySetTest.java
index 46dde8b575d..9f5bb2c23db 100644
--- a/transport/src/test/java/io/netty/channel/nio/SelectedSelectionKeySetTest.java
+++ b/transport/src/test/java/io/netty/channel/nio/SelectedSelectionKeySetTest.java
@@ -102,8 +102,8 @@ public void contains() {
         SelectedSelectionKeySet set = new SelectedSelectionKeySet();
         assertTrue(set.add(mockKey));
         assertTrue(set.add(mockKey2));
-        assertFalse(set.contains(mockKey));
-        assertFalse(set.contains(mockKey2));
+        assertTrue(set.contains(mockKey));
+        assertTrue(set.contains(mockKey2));
         assertFalse(set.contains(mockKey3));
     }
 
