 
     private var inFlushNow: Bool = false // Guard against re-entrance of flushNow() method.
     private var autoRead: Bool = true
-    private var lifecycleManager: SocketChannelLifecycleManager!
+    private var lifecycleManager: SocketChannelLifecycleManager {
+        didSet {
+            assert(self.eventLoop.inEventLoop)
+        }
+    }
 
     private var bufferAllocator: ByteBufferAllocator = ByteBufferAllocator() {
         didSet {

        self.unsetCachedAddressesFromSocket()
        self.cancelWritesOnClose(error: error)

        self.lifecycleManager.close(promise: p)()

        eventLoop.execute {
            // ensure this is executed in a delayed fashion as the users code may still traverse the pipeline

    private let selectableEventLoop: SelectableEventLoop
    private let addressesCached: AtomicBox<Box<(local:SocketAddress?, remote:SocketAddress?)>> = AtomicBox(value: Box((local: nil, remote: nil)))
    private let bufferAllocatorCached: AtomicBox<Box<ByteBufferAllocator>>
    private let isActiveAtomic: Atomic<Bool> = Atomic(value: false)
    private var _pipeline: ChannelPipeline! = nil // this is really a constant (set in .init) but needs `self` to be constructed and therefore a `var`. Do not change as this needs to accessed from arbitrary threads

    internal var interestedEvent: IOEvent = .none

