use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class LDAPMessageTestCase method testReadFromInvalidProtocolOpType.
/**
* Tests the {@code LDAPMessage.readFrom} method with invalid protocol op
* type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testReadFromInvalidProtocolOpType() throws Exception {
ASN1Buffer b = new ASN1Buffer();
ASN1BufferSequence s = b.beginSequence();
b.addInteger(1);
b.addOctetString();
s.end();
ByteArrayInputStream inputStream = new ByteArrayInputStream(b.toByteArray());
ASN1StreamReader reader = new ASN1StreamReader(inputStream);
LDAPMessage.readFrom(reader, true);
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class BindRequestProtocolOpTestCase method testReadInvalidCredType.
/**
* Tests the behavior when attempting to read a bind request protocol op
* with an invalid type of credentials.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testReadInvalidCredType() throws Exception {
ASN1Buffer b = new ASN1Buffer();
ASN1BufferSequence s = b.beginSequence((byte) 0x60);
b.addInteger(3);
b.addOctetString();
b.addOctetString((byte) 0x0F);
s.end();
ByteArrayInputStream inputStream = new ByteArrayInputStream(b.toByteArray());
ASN1StreamReader reader = new ASN1StreamReader(inputStream);
new BindRequestProtocolOp(reader);
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class BindRequestProtocolOpTestCase method testReadMalformedRequest.
/**
* Tests the behavior when attempting to read a malformed bind request
* protocol op.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testReadMalformedRequest() throws Exception {
ASN1Buffer b = new ASN1Buffer();
ASN1BufferSequence s = b.beginSequence((byte) 0x60);
b.addOctetString();
s.end();
ByteArrayInputStream inputStream = new ByteArrayInputStream(b.toByteArray());
ASN1StreamReader reader = new ASN1StreamReader(inputStream);
new BindRequestProtocolOp(reader);
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class BindResponseProtocolOpTestCase method testReadBindResponseInvalidElementType.
/**
* Tests the behavior when trying to read a bind response with an invalid
* element type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testReadBindResponseInvalidElementType() throws Exception {
ASN1Buffer b = new ASN1Buffer((byte) 0x61);
ASN1BufferSequence s = b.beginSequence();
b.addEnumerated(0);
b.addOctetString();
b.addOctetString();
b.addOctetString((byte) 0x80);
s.end();
ByteArrayInputStream inputStream = new ByteArrayInputStream(b.toByteArray());
ASN1StreamReader reader = new ASN1StreamReader(inputStream);
new BindResponseProtocolOp(reader);
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class LDAPMessageTestCase method testReadLDAPResponseFromInvalidProtocolOpType.
/**
* Tests the {@code LDAPMessage.readLDAPResponseFrom} method with invalid
* protocol op type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testReadLDAPResponseFromInvalidProtocolOpType() throws Exception {
ASN1Buffer b = new ASN1Buffer();
ASN1BufferSequence s = b.beginSequence();
b.addInteger(1);
b.addOctetString();
s.end();
ByteArrayInputStream inputStream = new ByteArrayInputStream(b.toByteArray());
ASN1StreamReader reader = new ASN1StreamReader(inputStream);
LDAPMessage.readLDAPResponseFrom(reader, true);
}
Aggregations