Solution (source code)

= Solution

Set $h_A(z)=\operatorname{Im}(z-g_A(z))$. This is a nonnegative <harmonic function> on $\mathbb H\setminus A$, has boundary value $\operatorname{Im}z$ on the hull boundary, and tends to zero on the real boundary. If $\tau$ is the first exit time of planar <Brownian motion> from $\mathbb H\setminus A$, the <optional stopping theorem> gives
$$
h_A(iy)=\mathbb E_{iy}[\operatorname{Im}B_\tau].
$$
The hydrodynamic expansion yields $h_A(iy)=\operatorname{hcap}(A)/y+O(y^{-2})$, and therefore the <Brownian representation of half-plane capacity>
$$
\boxed{\operatorname{hcap}(A)=\lim_{y\to\infty}y\mathbb E_{iy}[\operatorname{Im}B_\tau]}.
$$