         if listening { shutdown(_socket, CInt(SHUT_RDWR)) }
         close(_socket)
 #endif
+        _socket = nil
+    }
+
+    deinit {
+        try? closeSocket()
     }
 }
 


    override class func tearDown() {
        serverActive = false
        super.tearDown()
    }
}

        return _HTTPServer(socket: connection)
    }

    public func stop() throws {
        try tcpSocket.closeSocket()
    }
    
    public func request() throws -> _HTTPRequest {

        var reader = _SocketDataReader(socket: tcpSocket)
