  The conductivity of a two-dimensional HgTe quantum well with a width
$\sim$6.3~nm, close to the transition from ordinary to topological insulating
phases, is studied. The Fermi level is supposed to get to the overall energy
gap. The consideration is based on the percolation theory. We have found that
the width fluctuations convert the system to a random mixture of domains with
positive and negative energy gaps with internal edge states formed near zero
gap lines. In the case with no potential fluctuations, the conductance of a
finite sample is provided by a random edge states network. The zero-temperature
conductivity of an infinite sample is determined by the free motion of
electrons along the zero-gap lines and tunneling between them.
  The conductance of a single $p$-$n$ junction, which is crossed by the edge
state, is found. The result is applied to the situation when potential
fluctuations transform the system to a mixture of $p$- and $n$-domains. It is
stated that the tunneling across $p$-$n$ junctions forbids the low-temperature
conductivity of a random system, but the latter is restored due to the random
edge states crossing the junctions.
