         return pendingWrites.isWritable
     }
 
-    override public var isOpen: Bool {
+    override fileprivate var isOpen: Bool {
+        assert(eventLoop.inEventLoop)
         return pendingWrites.isOpen
     }
 

        try super.init(socket: serverSocket, eventLoop: eventLoop, recvAllocator:  AdaptiveRecvByteBufferAllocator())
    }

    public override func registrationFor(interested: IOEvent) -> NIORegistration {
        return .serverSocketChannel(self, interested)
    }


        return result
    }

    override fileprivate func writeToSocket() throws -> OverallWriteResult {
        let result = try self.pendingWrites.triggerAppropriateWriteOperations(scalarBufferWriteOperation: { ptr in
            guard ptr.count > 0 else {
                // No need to call write if the buffer is empty.
