public virtual void close() { if (connection != null) { try { connection.close(); } catch (Exception) { // ignore } connection = null; channelWriter.notifyCancellation(); if (logCallback != null) { logCallback.Log(LogEventArgs.LogLevel.LOW, "Closed connection to " + target); } } }