                         try? subServer.readAndRespond()
                     }
                 } catch {
-                    NSLog("httpServer: \(error)")
+                    if (serverActive) { // Ignore errors thrown on shutdown
+                        NSLog("httpServer: \(error)")
+                    }
                 }
             }
             serverPort = -2


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

        if listening { shutdown(_socket, CInt(SHUT_RDWR)) }
        close(_socket)
#endif
        _socket = nil
    }

    deinit {
        try? closeSocket()
    }
}

