private void internalDisconnect(final int reason) {
		userDisconnected = true;
		initialConnection = false;
		ready = false;

		final BleServerManager serverManager = this.serverManager;
		final BluetoothDevice bluetoothDevice = this.bluetoothDevice;
		if (serverManager != null && bluetoothDevice != null) {
			log(Log.VERBOSE, () -> "Cancelling server connection...");
			log(Log.DEBUG, () -> "server.cancelConnection(device)");
			serverManager.cancelConnection(bluetoothDevice);
		}

		final BluetoothGatt gatt = bluetoothGatt;
		if (gatt != null) {
			final boolean wasConnected = connected;
			connectionState = BluetoothGatt.STATE_DISCONNECTING;
			log(Log.VERBOSE, () -> wasConnected ? "Disconnecting..." : "Cancelling connection...");
			final BluetoothDevice device = gatt.getDevice();
			if (wasConnected) {
				postCallback(c -> c.onDeviceDisconnecting(device));
				postConnectionStateChange(o -> o.onDeviceDisconnecting(device));
			}
			log(Log.DEBUG, () -> "gatt.disconnect()");
			try {
				gatt.disconnect();
			} catch (final SecurityException e) {
				log(Log.ERROR, e::getLocalizedMessage);
			}
			if (wasConnected)
				return;

			// If the device wasn't connected, there will be no callback after calling
			// gatt.disconnect(), the connection attempt will be stopped.
			connectionState = BluetoothGatt.STATE_DISCONNECTED;
			log(Log.INFO, () -> "Disconnected");
			close();
			postCallback(c -> c.onDeviceDisconnected(device));
			postConnectionStateChange(o -> o.onDeviceDisconnected(device, reason));
		}
		// request may be of type DISCONNECT or CONNECT (timeout).
		// For the latter, it has already been notified with REASON_TIMEOUT.
		final Request r = request;
		if (r != null && r.type == Request.Type.DISCONNECT) {
			if (bluetoothDevice != null || gatt != null)
				r.notifySuccess(bluetoothDevice != null ? bluetoothDevice : gatt.getDevice());
			else
				r.notifyInvalidRequest();
		}
		nextRequest(true);
	}
Returns the value of the server descriptor. For descriptor that are not shared,
the value may be different for each connected device.

@param serverDescriptor The descriptor to get value of.
@return The value.
ble/src/main/java/no/nordicsemi/android/ble/BleManagerHandler.java