WFLY-3478 fixing mask verification

Backport of WFLY-3478 to 8.x.

9.x PR: https://github.com/wildfly/wildfly/pull/6411   (merged)
https://issues.jboss.org/browse/WFLY-3478