// Path: src/main/java/com/wizzardo/epoll/Utils.java
//     public static int readInt(byte[] b, int offset) {
// //        if (b.length - offset < 4 || offset < 0)
// //            throw new IndexOutOfBoundsException("byte[].length = " + b.length + ", but offset = " + offset + " and we need 4 bytes");
// 
//         return ((b[offset] & 0xff) << 24) + ((b[offset + 1] & 0xff) << 16) + ((b[offset + 2] & 0xff) << 8) + ((b[offset + 3] & 0xff));
//     }
// 
// Path: src/main/java/com/wizzardo/epoll/Utils.java
//     public static int readShort(byte[] b, int offset) {
// //        if (b.length - offset < 2 || offset < 0)
// //            throw new IndexOutOfBoundsException("byte[].length = " + b.length + ", but offset = " + offset + " and we need 2 bytes");
// 
//         return ((b[offset] & 0xff) << 8) + ((b[offset + 1] & 0xff));
//     }


import com.wizzardo.tools.misc.Unchecked;
import com.wizzardo.tools.reflection.FieldReflection;
import com.wizzardo.tools.reflection.FieldReflectionFactory;
import com.wizzardo.tools.reflection.UnsafeTools;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.regex.Pattern;
import static com.wizzardo.epoll.Utils.readInt;
import static com.wizzardo.epoll.Utils.readShort;
            ioThreads[i].start();
        }

        ByteBuffer eventsBuffer = this.events;
        byte[] events = new byte[eventsBuffer.capacity()];
        byte[] newConnections = new byte[eventsBuffer.capacity()];

        if (ioThreadsCount == 0) {
            IOThread<? extends T> ioThread = createIOThread(1, 1);
            ioThreadsCount = 1;
            ioThread.scope = scope;
            ioThreads = new IOThread[]{ioThread};
            ioThreads[0].setTTL(ttl);
            ioThreads[0].loadCertificates(sslConfig);

            long prev = System.nanoTime();
            while (running) {
                try {
                    eventsBuffer.position(0);
                    long now = System.nanoTime() * 1000;
                    long nowMinusSecond = now - 1_000_000_000_000L; // 1 sec
                    int r = waitForEvents(500);
                    eventsBuffer.limit(r);
                    eventsBuffer.get(events, 0, r);
                    int i = 0;
                    while (i < r) {
                        int event = events[i];
                        if (event == 0) {
                            acceptConnections(newConnections);
                        } else {
// Path: src/main/java/com/wizzardo/epoll/Utils.java
//     public static int readInt(byte[] b, int offset) {
// //        if (b.length - offset < 4 || offset < 0)
// //            throw new IndexOutOfBoundsException("byte[].length = " + b.length + ", but offset = " + offset + " and we need 4 bytes");
// 
//         return ((b[offset] & 0xff) << 24) + ((b[offset + 1] & 0xff) << 16) + ((b[offset + 2] & 0xff) << 8) + ((b[offset + 3] & 0xff));
//     }
// 
// Path: src/main/java/com/wizzardo/epoll/Utils.java
//     public static int readShort(byte[] b, int offset) {
// //        if (b.length - offset < 2 || offset < 0)
// //            throw new IndexOutOfBoundsException("byte[].length = " + b.length + ", but offset = " + offset + " and we need 2 bytes");
// 
//         return ((b[offset] & 0xff) << 8) + ((b[offset + 1] & 0xff));
//     }


// Path: src/main/java/com/wizzardo/epoll/EpollCore.java
import com.wizzardo.tools.misc.Unchecked;
import com.wizzardo.tools.reflection.FieldReflection;
import com.wizzardo.tools.reflection.FieldReflectionFactory;
import com.wizzardo.tools.reflection.UnsafeTools;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.regex.Pattern;
import static com.wizzardo.epoll.Utils.readInt;
import static com.wizzardo.epoll.Utils.readShort;

            ioThreads[i].start();
        }

        ByteBuffer eventsBuffer = this.events;
        byte[] events = new byte[eventsBuffer.capacity()];
        byte[] newConnections = new byte[eventsBuffer.capacity()];

        if (ioThreadsCount == 0) {
            IOThread<? extends T> ioThread = createIOThread(1, 1);
            ioThreadsCount = 1;
            ioThread.scope = scope;
            ioThreads = new IOThread[]{ioThread};
            ioThreads[0].setTTL(ttl);
            ioThreads[0].loadCertificates(sslConfig);

            long prev = System.nanoTime();
            while (running) {
                try {
                    eventsBuffer.position(0);
                    long now = System.nanoTime() * 1000;
                    long nowMinusSecond = now - 1_000_000_000_000L; // 1 sec
                    int r = waitForEvents(500);
                    eventsBuffer.limit(r);
                    eventsBuffer.get(events, 0, r);
                    int i = 0;
                    while (i < r) {
                        int event = events[i];
                        if (event == 0) {
                            acceptConnections(newConnections);
                        } else {
                            int fd = readInt(events, i + 1);