src/com/shrewdify/diaroser/tests/PeerImplTest.java
@Test
		public void test349() throws Exception{
			PeerImpl.Worker w=(new PeerImpl("myserveruri")).new Worker(className, dbhost, dbname, dbuser, dbpassword);
			byte temp[]={1, 0, 0, -92, -128, 0, 1, 16, 0, 0, 0, 0, 117, 127, 19, -116, 41, -96, 0, 0};
			String uri = "myserveruri";
			String realm = "truphone";
			HashSet<Avp> avpset=new HashSet<Avp>();
			avpset.add(new Avp(264, (short)80, 0, uri.getBytes()));
			avpset.add(new Avp(296,(short)80,0 , realm.getBytes()));
			avpset.add(new Avp(258,(short)80,0 , par.int32ToBytes(9)));
			avpset.add(new Avp(263, (short)80, 0, sessionId.getBytes()));
			avpset.add(new Avp(283, (short)80, 0, "truphone".getBytes()));
			avpset.add(new Avp(461, (short)80, 0, service_context.getBytes()));
			avpset.add(new Avp(416, (short)80, 0, par.int32ToBytes(1)));
			avpset.add(new Avp(415, (short)80, 0, par.int32ToBytes(1)));
			HashSet<Avp> t=new HashSet<Avp>();
			t.add(new Avp(450, (short)80, 0, par.int32ToBytes(0)));
			t.add(new Avp(444, (short)80, 0, aNumber.getBytes()));
			avpset.add(new Avp(443, (short)80, 0, par.encodeAvpSet(t)));
			avpset.add(new Avp(455, (short)80, 0, par.int32ToBytes(1)));
			avpset.add(new Avp(456, (short)80, 0, par.encodeAvp(new Avp(437,(short)80,0,par.encodeAvp(new Avp(417,(short)80,0,par.int32ToBytes(1)))))));
			t.clear();
			HashSet<Avp> t1=new HashSet<Avp>();
			t1.add(new Avp(829, (short)80, 10415, par.int32ToBytes(1)));
			t1.add(new Avp(862, (short)80, 10415, par.int32ToBytes(6)));
			t1.add(new Avp(831, (short)80, 10415, ("tel:"+aNumber).getBytes()));
			t1.add(new Avp(832, (short)80, 10415, ("tel:"+bNumber).getBytes()));
			t1.add(new Avp(841, (short)80, 10415, "0234ca0037".getBytes()));
			t.add(new Avp(876, (short)80, 10415, par.encodeAvpSet(t1)));
			byte mncmcc[]={0,98,(byte)248,48,0};
			t.add(new Avp(874, (short)80, 10415, par.encodeAvp(new Avp(22, (short)40, 10415, mncmcc))));
			avpset.add(new Avp(873,(short)80,10415,par.encodeAvpSet(t)));
			byte packet[]=merge(par.encodeAvpSet(avpset),temp);
			byte resulPac[]=null;

			resulPac = w.processBillingRequest(packet);
			Hashtable<Integer, Avp> hs;
			int resCode=0;
			try{
				hs = par.decodeAvpSet(resulPac, 20);

				resCode=par.bytesToInt(hs.get(268).rawData);
				System.out.println(resCode);
				assertEquals(3007,par.bytesToInt(hs.get(268).rawData));

		
			}catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}	
		}
//Test for  wrong  Auth Application id.

Test for  wrong  Auth Application id.
Test for wrong Auth Application id .
@Test
		public void test349() throws Exception{
			PeerImpl.Worker w=(new PeerImpl("myserveruri")).new Worker(className, dbhost, dbname, dbuser, dbpassword);
			byte temp[]={1, 0, 0, -92, -128, 0, 1, 16, 0, 0, 0, 0, 117, 127, 19, -116, 41, -96, 0, 0};
			String uri = "myserveruri";
			String realm = "truphone";
			HashSet<Avp> avpset=new HashSet<Avp>();
			avpset.add(new Avp(264, (short)80, 0, uri.getBytes()));
			avpset.add(new Avp(296,(short)80,0 , realm.getBytes()));
			avpset.add(new Avp(258,(short)80,0 , par.int32ToBytes(9)));
			avpset.add(new Avp(263, (short)80, 0, sessionId.getBytes()));
			avpset.add(new Avp(283, (short)80, 0, "truphone".getBytes()));
			avpset.add(new Avp(461, (short)80, 0, service_context.getBytes()));
			avpset.add(new Avp(416, (short)80, 0, par.int32ToBytes(1)));
			avpset.add(new Avp(415, (short)80, 0, par.int32ToBytes(1)));
			HashSet<Avp> t=new HashSet<Avp>();
			t.add(new Avp(450, (short)80, 0, par.int32ToBytes(0)));
			t.add(new Avp(444, (short)80, 0, aNumber.getBytes()));
			avpset.add(new Avp(443, (short)80, 0, par.encodeAvpSet(t)));
			avpset.add(new Avp(455, (short)80, 0, par.int32ToBytes(1)));
			avpset.add(new Avp(456, (short)80, 0, par.encodeAvp(new Avp(437,(short)80,0,par.encodeAvp(new Avp(417,(short)80,0,par.int32ToBytes(1)))))));
			t.clear();
			HashSet<Avp> t1=new HashSet<Avp>();
			t1.add(new Avp(829, (short)80, 10415, par.int32ToBytes(1)));
			t1.add(new Avp(862, (short)80, 10415, par.int32ToBytes(6)));
			t1.add(new Avp(831, (short)80, 10415, ("tel:"+aNumber).getBytes()));
			t1.add(new Avp(832, (short)80, 10415, ("tel:"+bNumber).getBytes()));
			t1.add(new Avp(841, (short)80, 10415, "0234ca0037".getBytes()));
			t.add(new Avp(876, (short)80, 10415, par.encodeAvpSet(t1)));
			byte mncmcc[]={0,98,(byte)248,48,0};
			t.add(new Avp(874, (short)80, 10415, par.encodeAvp(new Avp(22, (short)40, 10415, mncmcc))));
			avpset.add(new Avp(873,(short)80,10415,par.encodeAvpSet(t)));
			byte packet[]=merge(par.encodeAvpSet(avpset),temp);
			byte resulPac[]=null;
			resulPac = w.processBillingRequest(packet);
			Hashtable<Integer, Avp> hs;
			int resCode=0;
			try{
				hs = par.decodeAvpSet(resulPac, 20);
				resCode=par.bytesToInt(hs.get(268).rawData);
				System.out.println(resCode);
				assertEquals(3007,par.bytesToInt(hs.get(268).rawData));
			}catch (Exception e) {
				e.printStackTrace();
			}	
		}
@ Test public void test349 ( ) throws Exception { PeerImpl . Worker w = ( new PeerImpl ( "myserveruri" ) ) . new Worker ( className , dbhost , dbname , dbuser , dbpassword ) ; byte temp [ ] = { 1 , 0 , 0 , - 92 , - 128 , 0 , 1 , 16 , 0 , 0 , 0 , 0 , 117 , 127 , 19 , - 116 , 41 , - 96 , 0 , 0 } ; String uri = "myserveruri" ; String realm = "truphone" ; HashSet < Avp > avpset = new HashSet < Avp > ( ) ; avpset . add ( new Avp ( 264 , ( short ) 80 , 0 , uri . getBytes ( ) ) ) ; avpset . add ( new Avp ( 296 , ( short ) 80 , 0 , realm . getBytes ( ) ) ) ; avpset . add ( new Avp ( 258 , ( short ) 80 , 0 , par . int32ToBytes ( 9 ) ) ) ; avpset . add ( new Avp ( 263 , ( short ) 80 , 0 , sessionId . getBytes ( ) ) ) ; avpset . add ( new Avp ( 283 , ( short ) 80 , 0 , "truphone" . getBytes ( ) ) ) ; avpset . add ( new Avp ( 461 , ( short ) 80 , 0 , service_context . getBytes ( ) ) ) ; avpset . add ( new Avp ( 416 , ( short ) 80 , 0 , par . int32ToBytes ( 1 ) ) ) ; avpset . add ( new Avp ( 415 , ( short ) 80 , 0 , par . int32ToBytes ( 1 ) ) ) ; HashSet < Avp > t = new HashSet < Avp > ( ) ; t . add ( new Avp ( 450 , ( short ) 80 , 0 , par . int32ToBytes ( 0 ) ) ) ; t . add ( new Avp ( 444 , ( short ) 80 , 0 , aNumber . getBytes ( ) ) ) ; avpset . add ( new Avp ( 443 , ( short ) 80 , 0 , par . encodeAvpSet ( t ) ) ) ; avpset . add ( new Avp ( 455 , ( short ) 80 , 0 , par . int32ToBytes ( 1 ) ) ) ; avpset . add ( new Avp ( 456 , ( short ) 80 , 0 , par . encodeAvp ( new Avp ( 437 , ( short ) 80 , 0 , par . encodeAvp ( new Avp ( 417 , ( short ) 80 , 0 , par . int32ToBytes ( 1 ) ) ) ) ) ) ) ; t . clear ( ) ; HashSet < Avp > t1 = new HashSet < Avp > ( ) ; t1 . add ( new Avp ( 829 , ( short ) 80 , 10415 , par . int32ToBytes ( 1 ) ) ) ; t1 . add ( new Avp ( 862 , ( short ) 80 , 10415 , par . int32ToBytes ( 6 ) ) ) ; t1 . add ( new Avp ( 831 , ( short ) 80 , 10415 , ( "tel:" + aNumber ) . getBytes ( ) ) ) ; t1 . add ( new Avp ( 832 , ( short ) 80 , 10415 , ( "tel:" + bNumber ) . getBytes ( ) ) ) ; t1 . add ( new Avp ( 841 , ( short ) 80 , 10415 , "0234ca0037" . getBytes ( ) ) ) ; t . add ( new Avp ( 876 , ( short ) 80 , 10415 , par . encodeAvpSet ( t1 ) ) ) ; byte mncmcc [ ] = { 0 , 98 , ( byte ) 248 , 48 , 0 } ; t . add ( new Avp ( 874 , ( short ) 80 , 10415 , par . encodeAvp ( new Avp ( 22 , ( short ) 40 , 10415 , mncmcc ) ) ) ) ; avpset . add ( new Avp ( 873 , ( short ) 80 , 10415 , par . encodeAvpSet ( t ) ) ) ; byte packet [ ] = merge ( par . encodeAvpSet ( avpset ) , temp ) ; byte resulPac [ ] = null ; resulPac = w . processBillingRequest ( packet ) ; Hashtable < Integer , Avp > hs ; int resCode = 0 ; try { hs = par . decodeAvpSet ( resulPac , 20 ) ; resCode = par . bytesToInt ( hs . get ( 268 ) . rawData ) ; System . out . println ( resCode ) ; assertEquals ( 3007 , par . bytesToInt ( hs . get ( 268 ) . rawData ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
Test for  wrong  Auth Application id.
Test for wrong Auth Application id .
// TODO Auto-generated catch block
