String attrName = attrValAssertion.getName();
ByteString attrValue = ByteString.valueOf(attrValAssertion.getValue());
ByteString dnStr = ByteString.valueOf(compareRequest.getDn());
// Create and send the LDAP compare request to the server.
ProtocolOp op = new CompareRequestProtocolOp(dnStr, attrName, attrValue);
LDAPMessage msg = new LDAPMessage(DSMLServlet.nextMessageID(), op);
connection.getLDAPWriter().writeMessage(msg);
// Read and decode the LDAP response from the server.
LDAPMessage responseMessage = connection.getLDAPReader().readMessage();