}
if ( ( ( Request ) message ).getControls().size() > 0
&& message instanceof ResultResponseRequest )
{
ResultResponseRequest req = ( ResultResponseRequest ) message;
for ( Control control : req.getControls().values() )
{
if ( control.isCritical() && !ldapServer.getSupportedControls().contains( control.getOid() ) )
{
ResultResponse resp = req.getResultResponse();
resp.getLdapResult().setDiagnosticMessage( "Unsupport critical control: " + control.getOid() );
resp.getLdapResult().setResultCode( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION );
session.write( resp );
return;