         }
     }
 
-    // MARK: -
-
-    private func handleDisconnect() {
+    private func handleDisconnect() throws {
         let remoteDisconnect = (state != .Disconnecting)
 
-        close(socketDescriptor)
+        try socket.close()
 
         state = .Unconnected
 

        disconnectCallback?(Result.Success())
        disconnectCallback = nil
    }
}

        try self.init(address: addresses.first!, port: port)
    }

    public init(address: Address, port: UInt16, socket: Socket) throws {
        self.address = address
        self.port = port
        self.socket = socket
    }

    public func connect(callback: Result <Void> -> Void) {

        precondition(state == .Unconnected)

        if queue == nil {
            let queueAttribute = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, qos, 0)
            queue = dispatch_queue_create("io.schwa.SwiftIO.UDP.receiveQueue", queueAttribute)
        }

        dispatch_async(queue) {
            [weak self, address, port] in

            guard let strong_self = self else {
                return
