directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1235326 [20/28] - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partitio...
Date Tue, 24 Jan 2012 16:15:29 GMT
Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbErrorDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbErrorDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbErrorDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbErrorDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -20,6 +20,7 @@
 
 package org.apache.directory.shared.kerberos.codec;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -38,6 +39,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 
+
 /**
  * Test cases for KrbError codec
  *
@@ -49,68 +51,167 @@ public class KrbErrorDecoderTest
     public void testDecodeKrbError()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x8F;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x81, (byte)0x8C,
-                  0x30, (byte)0x81, (byte)0x89,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA2, 0x11,           // ctime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA3, 0x03,           // cusec
-                      0x02, 0x01, 0x01,
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA7, 0x08,            // crealm
-                      0x1B, 0x06, 'c', 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xA8, 0x12,           // cname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 'c', 'n', 'a', 'm', 'e',
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                    (byte)0xAB, 0x07,           // e-text
-                      0x1B, 0x5, 'e', 't', 'e', 'x', 't',
-                    (byte)0xAC, 0x04,           // e-data
-                      0x04, 0x02, 
-                        0x00, 0x01
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x81, ( byte ) 0x8C,
+                0x30, ( byte ) 0x81, ( byte ) 0x89,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA2,
+                0x11, // ctime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA3,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA7,
+                0x08, // crealm
+                0x1B,
+                0x06,
+                'c',
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xA8,
+                0x12, // cname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                'c',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xAB,
+                0x07, // e-text
+                0x1B,
+                0x5,
+                'e',
+                't',
+                'e',
+                'x',
+                't',
+                ( byte ) 0xAC,
+                0x04, // e-data
+                0x04,
+                0x02,
+                0x00,
+                0x01
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         String time = "20101119080043Z";
         assertEquals( 5, krbError.getProtocolVersionNumber() );
         assertEquals( KerberosMessageType.KRB_ERROR, krbError.getMessageType() );
@@ -124,845 +225,1684 @@ public class KrbErrorDecoderTest
         assertEquals( "realm", krbError.getRealm() );
         assertEquals( "sname", krbError.getSName().getNameString() );
         assertEquals( "etext", krbError.getEText() );
-        assertTrue( Arrays.equals( new byte[]{0,1}, krbError.getEData() ) );
-        
+        assertTrue( Arrays.equals( new byte[]
+            { 0, 1 }, krbError.getEData() ) );
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
-    
-    
+
+
     @Test
     public void testDecodeKrbErrorWithoutCtime()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x7A;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x78,
-                  0x30, (byte)0x76,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,
-                      //
-                      // NO ctime
-                      //
-                    (byte)0xA3, 0x03,           // cusec
-                      0x02, 0x01, 0x01,
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA7, 0x08,            // crealm
-                      0x1B, 0x06, 'c', 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xA8, 0x12,           // cname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 'c', 'n', 'a', 'm', 'e',
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                    (byte)0xAB, 0x07,           // e-text
-                      0x1B, 0x5, 'e', 't', 'e', 'x', 't',
-                    (byte)0xAC, 0x04,           // e-data
-                      0x04, 0x02, 
-                        0x00, 0x01
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x78,
+                0x30, ( byte ) 0x76,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                //
+                // NO ctime
+                //
+                ( byte ) 0xA3,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA7,
+                0x08, // crealm
+                0x1B,
+                0x06,
+                'c',
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xA8,
+                0x12, // cname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                'c',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xAB,
+                0x07, // e-text
+                0x1B,
+                0x5,
+                'e',
+                't',
+                'e',
+                'x',
+                't',
+                ( byte ) 0xAC,
+                0x04, // e-data
+                0x04,
+                0x02,
+                0x00,
+                0x01
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getCTime() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeKrbErrorWithoutCusec()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x8A;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x81, (byte)0x87,
-                  0x30, (byte)0x81, (byte)0x84,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA2, 0x11,           // ctime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                      // NO cuses
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA7, 0x08,            // crealm
-                      0x1B, 0x06, 'c', 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xA8, 0x12,           // cname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 'c', 'n', 'a', 'm', 'e',
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                    (byte)0xAB, 0x07,           // e-text
-                      0x1B, 0x5, 'e', 't', 'e', 'x', 't',
-                    (byte)0xAC, 0x04,           // e-data
-                      0x04, 0x02, 
-                        0x00, 0x01
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x81, ( byte ) 0x87,
+                0x30, ( byte ) 0x81, ( byte ) 0x84,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA2,
+                0x11, // ctime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                // NO cuses
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA7,
+                0x08, // crealm
+                0x1B,
+                0x06,
+                'c',
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xA8,
+                0x12, // cname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                'c',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xAB,
+                0x07, // e-text
+                0x1B,
+                0x5,
+                'e',
+                't',
+                'e',
+                'x',
+                't',
+                ( byte ) 0xAC,
+                0x04, // e-data
+                0x04,
+                0x02,
+                0x00,
+                0x01
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertEquals( 0, krbError.getCusec() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
+
     @Test
     public void testDecodeKrbErrorWithoutCtimeAndCusec()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x75;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x73,
-                  0x30, (byte)0x71,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,
-                      //
-                      // NO ctime, cusec
-                      //
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA7, 0x08,            // crealm
-                      0x1B, 0x06, 'c', 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xA8, 0x12,           // cname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 'c', 'n', 'a', 'm', 'e',
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                    (byte)0xAB, 0x07,           // e-text
-                      0x1B, 0x5, 'e', 't', 'e', 'x', 't',
-                    (byte)0xAC, 0x04,           // e-data
-                      0x04, 0x02, 
-                        0x00, 0x01
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x73,
+                0x30, ( byte ) 0x71,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                //
+                // NO ctime, cusec
+                //
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA7,
+                0x08, // crealm
+                0x1B,
+                0x06,
+                'c',
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xA8,
+                0x12, // cname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                'c',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xAB,
+                0x07, // e-text
+                0x1B,
+                0x5,
+                'e',
+                't',
+                'e',
+                'x',
+                't',
+                ( byte ) 0xAC,
+                0x04, // e-data
+                0x04,
+                0x02,
+                0x00,
+                0x01
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getCTime() );
         assertEquals( 0, krbError.getCusec() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeKrbErrorWithoutCrealm()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x84;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x81, (byte)0x81,
-                  0x30, (byte)0x7F,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA2, 0x11,           // ctime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA3, 0x03,           // cusec
-                      0x02, 0x01, 0x01,
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                      // NO crealm
-                    (byte)0xA8, 0x12,           // cname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 'c', 'n', 'a', 'm', 'e',
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                    (byte)0xAB, 0x07,           // e-text
-                      0x1B, 0x5, 'e', 't', 'e', 'x', 't',
-                    (byte)0xAC, 0x04,           // e-data
-                      0x04, 0x02, 
-                        0x00, 0x01
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x81, ( byte ) 0x81,
+                0x30, ( byte ) 0x7F,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA2,
+                0x11, // ctime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA3,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                // NO crealm
+                ( byte ) 0xA8,
+                0x12, // cname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                'c',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xAB,
+                0x07, // e-text
+                0x1B,
+                0x5,
+                'e',
+                't',
+                'e',
+                'x',
+                't',
+                ( byte ) 0xAC,
+                0x04, // e-data
+                0x04,
+                0x02,
+                0x00,
+                0x01
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getCRealm() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeKrbErrorWithoutCname()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x79;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x77,
-                  0x30, (byte)0x75,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA2, 0x11,           // ctime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA3, 0x03,           // cusec
-                      0x02, 0x01, 0x01,
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA7, 0x08,            // crealm
-                      0x1B, 0x06, 'c', 'r', 'e', 'a', 'l', 'm',
-                      // NO cname
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                    (byte)0xAB, 0x07,           // e-text
-                      0x1B, 0x5, 'e', 't', 'e', 'x', 't',
-                    (byte)0xAC, 0x04,           // e-data
-                      0x04, 0x02, 
-                        0x00, 0x01
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x77,
+                0x30, ( byte ) 0x75,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA2,
+                0x11, // ctime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA3,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA7,
+                0x08, // crealm
+                0x1B,
+                0x06,
+                'c',
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                // NO cname
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xAB,
+                0x07, // e-text
+                0x1B,
+                0x5,
+                'e',
+                't',
+                'e',
+                'x',
+                't',
+                ( byte ) 0xAC,
+                0x04, // e-data
+                0x04,
+                0x02,
+                0x00,
+                0x01
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getCName() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeKrbErrorWithoutCrealmAndCname()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x6F;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x6D,
-                  0x30, (byte)0x6B,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA2, 0x11,           // ctime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA3, 0x03,           // cusec
-                      0x02, 0x01, 0x01,
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                      // NO crealm and cname
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                    (byte)0xAB, 0x07,           // e-text
-                      0x1B, 0x5, 'e', 't', 'e', 'x', 't',
-                    (byte)0xAC, 0x04,           // e-data
-                      0x04, 0x02, 
-                        0x00, 0x01
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x6D,
+                0x30, ( byte ) 0x6B,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA2,
+                0x11, // ctime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA3,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                // NO crealm and cname
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xAB,
+                0x07, // e-text
+                0x1B,
+                0x5,
+                'e',
+                't',
+                'e',
+                'x',
+                't',
+                ( byte ) 0xAC,
+                0x04, // e-data
+                0x04,
+                0x02,
+                0x00,
+                0x01
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getCRealm() );
         assertNull( krbError.getCName() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeKrbErrorWithoutEtext()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x86;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x81, (byte)0x83,
-                  0x30, (byte)0x81, (byte)0x80,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA2, 0x11,           // ctime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA3, 0x03,           // cusec
-                      0x02, 0x01, 0x01,
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA7, 0x08,            // crealm
-                      0x1B, 0x06, 'c', 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xA8, 0x12,           // cname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 'c', 'n', 'a', 'm', 'e',
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                            // NO etext
-                    (byte)0xAC, 0x04,           // e-data
-                      0x04, 0x02, 
-                        0x00, 0x01
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x81, ( byte ) 0x83,
+                0x30, ( byte ) 0x81, ( byte ) 0x80,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA2,
+                0x11, // ctime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA3,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA7,
+                0x08, // crealm
+                0x1B,
+                0x06,
+                'c',
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xA8,
+                0x12, // cname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                'c',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                // NO etext
+                ( byte ) 0xAC,
+                0x04, // e-data
+                0x04,
+                0x02,
+                0x00,
+                0x01
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getEText() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeKrbErrorWithoutEdata()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x89;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x81, (byte)0x86,
-                  0x30, (byte)0x81, (byte)0x83,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA2, 0x11,           // ctime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA3, 0x03,           // cusec
-                      0x02, 0x01, 0x01,
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA7, 0x08,            // crealm
-                      0x1B, 0x06, 'c', 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xA8, 0x12,           // cname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 'c', 'n', 'a', 'm', 'e',
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                    (byte)0xAB, 0x07,           // e-text
-                      0x1B, 0x5, 'e', 't', 'e', 'x', 't'
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x81, ( byte ) 0x86,
+                0x30, ( byte ) 0x81, ( byte ) 0x83,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA2,
+                0x11, // ctime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA3,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA7,
+                0x08, // crealm
+                0x1B,
+                0x06,
+                'c',
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xA8,
+                0x12, // cname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                'c',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xAB,
+                0x07, // e-text
+                0x1B,
+                0x5,
+                'e',
+                't',
+                'e',
+                'x',
+                't'
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getEData() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeKrbErrorWithoutEtextAndEdata()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x7E;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x7C,
-                  0x30, (byte)0x7A,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA2, 0x11,           // ctime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA3, 0x03,           // cusec
-                      0x02, 0x01, 0x01,
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA7, 0x08,            // crealm
-                      0x1B, 0x06, 'c', 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xA8, 0x12,           // cname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 'c', 'n', 'a', 'm', 'e',
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
-                            // NO etext and edata
-        } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        stream.flip();
-        
-        KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+            {
+                0x7E, ( byte ) 0x7C,
+                0x30, ( byte ) 0x7A,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA2,
+                0x11, // ctime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA3,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA7,
+                0x08, // crealm
+                0x1B,
+                0x06,
+                'c',
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xA8,
+                0x12, // cname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                'c',
+                'n',
+                'a',
+                'm',
+                'e',
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
+            // NO etext and edata
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
+        stream.flip();
+
+        KrbErrorContainer container = new KrbErrorContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getEText() );
         assertNull( krbError.getEData() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeKrbErrorWithoutOptionalFields()
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x48;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-                0x7E, (byte)0x46,
-                  0x30, (byte)0x44,
-                    (byte)0xA0, 0x03,           // pvno
-                      0x02, 0x01, 0x05,    
-                    (byte)0xA1, 0x03,           // msg-type
-                      0x02, 0x01, 0x1E,   
-                    (byte)0xA4, 0x11,           // stime
-                      0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-                    (byte)0xA5, 0x03,           // susec
-                      0x02, 0x01, 0x02,
-                    (byte)0xA6, 0x03,           // error-code
-                      0x02, 0x01, 0x00,
-                    (byte)0xA9, 0x07,           // realm
-                      0x1B, 0x05, 'r', 'e', 'a', 'l', 'm',
-                    (byte)0xAA, 0x12,           // sname
-                      0x30, 0x10, 
-                        (byte)0xA0, 0x03,
-                          0x02, 0x01, 0x00, 
-                        (byte)0xA1, 0x09, 
-                          0x30, 0x07, 
-                            0x1B, 0x05, 's', 'n', 'a', 'm', 'e',
+            {
+                0x7E, ( byte ) 0x46,
+                0x30, ( byte ) 0x44,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x1E,
+                ( byte ) 0xA4,
+                0x11, // stime
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA5,
+                0x03, // susec
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA6,
+                0x03, // error-code
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA9,
+                0x07, // realm
+                0x1B,
+                0x05,
+                'r',
+                'e',
+                'a',
+                'l',
+                'm',
+                ( byte ) 0xAA,
+                0x12, // sname
+                0x30,
+                0x10,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x00,
+                ( byte ) 0xA1,
+                0x09,
+                0x30,
+                0x07,
+                0x1B,
+                0x05,
+                's',
+                'n',
+                'a',
+                'm',
+                'e',
         } );
-        
-        String decoded = Strings.dumpBytes(stream.array());
+
+        String decoded = Strings.dumpBytes( stream.array() );
         stream.flip();
-        
+
         KrbErrorContainer container = new KrbErrorContainer( stream );
-        
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbError krbError = container.getKrbError();
-        
+
         assertNull( krbError.getCTime() );
         assertEquals( 0, krbError.getCusec() );
         assertNull( krbError.getCRealm() );
         assertNull( krbError.getCName() );
         assertNull( krbError.getEText() );
         assertNull( krbError.getEData() );
-        
+
         int encodedLen = krbError.computeLength();
-        
+
         assertEquals( streamLen, encodedLen );
-        
+
         ByteBuffer buffer = ByteBuffer.allocate( streamLen );
         try
         {
             buffer = krbError.encode( buffer );
-            
-            assertEquals( decoded, Strings.dumpBytes(buffer.array()) );
+
+            assertEquals( decoded, Strings.dumpBytes( buffer.array() ) );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbPrivDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbPrivDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbPrivDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KrbPrivDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -20,6 +20,7 @@
 
 package org.apache.directory.shared.kerberos.codec;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
@@ -35,6 +36,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 
+
 /**
  * Test cases for KrbPriv codec
  *
@@ -45,57 +47,72 @@ public class KrbPrivDecoderTest
     @Test
     public void testKrbPrivDecoderTest() throws Exception
     {
-        byte[] data = new byte[]{
-            0x75, 0x1B,
-              0x30, 0x19,
-               (byte)0xA0, 0x03,        // pvno
-                      0x02, 0x01, 0x05,
-               (byte)0xA1, 0x03,        // msg-type
-                      0x02, 0x01, 0x15,
-               (byte)0xA3, 0x0D,
-                      0x30, 0x0B,
-                       (byte)0xA0, 0x03,
-                              0x02, 0x01, 0x03,
-                       (byte)0xA2, 0x04,
-                              0x04, 0x02, 0x00, 0x01 
+        byte[] data = new byte[]
+            {
+                0x75, 0x1B,
+                0x30, 0x19,
+                ( byte ) 0xA0, 0x03, // pvno
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x15,
+                ( byte ) 0xA3,
+                0x0D,
+                0x30,
+                0x0B,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x03,
+                ( byte ) 0xA2,
+                0x04,
+                0x04,
+                0x02,
+                0x00,
+                0x01
         };
 
         int streamLen = data.length;
         ByteBuffer stream = ByteBuffer.wrap( data );
-        
-        String decoded = Strings.dumpBytes(stream.array());
-        
+
+        String decoded = Strings.dumpBytes( stream.array() );
+
         Asn1Decoder decoder = new Asn1Decoder();
-        
-        KrbPrivContainer container = new  KrbPrivContainer( stream );
-        
+
+        KrbPrivContainer container = new KrbPrivContainer( stream );
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         KrbPriv krbPriv = container.getKrbPriv();
-        
+
         assertEquals( 5, krbPriv.getProtocolVersionNumber() );
         assertEquals( KerberosMessageType.KRB_PRIV, krbPriv.getMessageType() );
         assertNotNull( krbPriv.getEncPart() );
-        
+
         int encodedLen = krbPriv.computeLength();
         assertEquals( streamLen, encodedLen );
-        
+
         try
         {
             ByteBuffer bb = ByteBuffer.allocate( encodedLen );
             krbPriv.encode( bb );
-            
-            String encoded = Strings.dumpBytes(bb.array());
+
+            String encoded = Strings.dumpBytes( bb.array() );
             assertEquals( decoded, encoded );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }



Mime
View raw message