Man sentenced to 40 years throws feces in court