I am trying to solve the following system of differential equations numerically over the domain $x=0$ to $x=D$. The main difficulty is that the boundary conditions are interconnected and depend on the solution variable. I'm not too sure how to approach the finding a numerical solution for that reason.
$$ \frac{dI_1}{dx} = -\alpha(x) I_1(x) \\ -\frac{dI_2}{dx} = -\alpha(x) I_2(x) $$
subject to the interconnected boundary conditions,
$$ I_1(0) = AI_2(0) + C\\ I_2(D) = BI_1(D) $$
where $A$, $B$, $C$ are known constants.
Background
This is an optics problem and describes the multiple reflection of light entering and exiting a dielectric layer with surface reflection coefficients $A$ and $B$, absorption coefficient $\alpha$, $C=(1 - A)I_0$ where $I_0$ is the incident intensity (a known constant).
I have divided the propagation into two streams which propagate downwards and upwards. This is a common approach for solving the radiative transfer equation. The $I_1$ equation is the intensity of light propagating to the right, and $I_2$ is the intensity propagating backwards to the left. So the total intensity is $I(x) = I_1(x) + I_2(x)$.
Analytical solution when $\alpha(x)$ is constant
If anyone is interested there is an analytical solution in the limit that $\alpha(x)\rightarrow\alpha$,
$$ I(x) = I_{1}\left(x\right)+I_{2}\left(x\right)=-\frac{{\left(Be^{\left(2\,\alpha x\right)}+e^{\left(2\,D\alpha\right)}\right)}Ce^{\left(-\alpha x\right)}}{AB-e^{\left(2\,D\alpha\right)}} $$
when $A=B=0$ this reduces to the Beer-Lambert law as expected,
$$ I(x) = I_0e^{-\alpha x} $$
This is a useful expression because this way you don't have to calculate and keep track of the magnitude of the multiple reflections.