JWSHeader header = new JWSHeader(JWSAlgorithm.HS512);
header.setCustomParameter("exp", "2014-04-24");
header.setCriticalHeaders(new HashSet<String>(Arrays.asList("exp")));
JWSObject jwsObject = new JWSObject(header, payload);
MACSigner signer = new MACSigner(stringSecret);
jwsObject.sign(signer);
assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());
MACVerifier verifier = new MACVerifier(stringSecret);
boolean verified = jwsObject.verify(verifier);
assertFalse("Verified signature", verified);
assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());
}