*/
public void decode( IoSession session, IoBuffer buffer, ProtocolDecoderOutput out ) throws Exception
{
// Allocate a LdapMessage Container
Asn1Decoder ldapDecoder = new Asn1Decoder();
Asn1Container ldapMessageContainer = ( LdapMessageContainer<?> ) session.getAttribute( "LDAP-Container" );
ByteBuffer buf = buffer.buf();
int currentPos = 0;
while ( buf.hasRemaining() )
{
try
{
ldapDecoder.decode( buf, ldapMessageContainer );
if ( IS_DEBUG )
{
LOG.debug( "Decoding the PDU : " );
int pos = buf.position();
byte[] b = new byte[pos - currentPos];
System.arraycopy( buf.array(), currentPos, b, 0, pos - currentPos );
currentPos = pos;
LOG.debug( "Received buffer : " + Strings.dumpBytes(b) );
}
if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
{
// get back the decoded message
Message message = ( ( LdapMessageContainer<?> ) ldapMessageContainer ).getMessage();
if ( IS_DEBUG )