DN responseDn = DN.decode(dn);
ByteString serverSASLCredentials =
ByteString.valueOf(saslCreds);
ByteStringBuilder bsb = new ByteStringBuilder();
ASN1Writer writer = ASN1.getWriter(bsb);
writer.writeStartSequence(OP_TYPE_BIND_RESPONSE);
writer.writeInteger(okCode.getIntValue());
writer.writeOctetString(responseDn.toString());
writer.writeOctetString(message.toString());
writer.writeInteger(Long.MAX_VALUE);
writer.writeOctetString(TYPE_SERVER_SASL_CREDENTIALS,
serverSASLCredentials);
writer.writeEndSequence();
ASN1Reader reader = ASN1.getReader(bsb.toByteString());
ProtocolOp protocolOp = LDAPReader.readProtocolOp(reader);
assertTrue(protocolOp instanceof BindResponseProtocolOp);