Determination of boundary conditions in extended thermodynamics via fluctuation theory