Cookies cs=new Cookies(null);
cs.processCookieHeader( s.getBytes(), 0, s.length());
int num = cs.getCookieCount();
if (num != 4)
throw new Exception("wrong number of cookies " + num);
ServerCookie co = cs.getCookie(0);
System.out.println("1 - Cookie: " + co);
ServerCookie co2 = cs.getCookie(1);
System.out.println("2 - Cookie: " + co2);
ServerCookie co3 = cs.getCookie(2);
System.out.println("3 - Cookie: " + co3);
ServerCookie co4 = cs.getCookie(3);
System.out.println("4 - Cookie: " + co4);
String coname = co.getName().toString();
String coval = co.getValue().toString();
if ( ! name.equals(coname))
throw new Exception("1 - wrong name " + coname + " != " + name);
if ( ! val.equals(coval))
throw new Exception("1 - wrong value " + coval + " != " + val);
String coname2 = co2.getName().toString();
String coval2 = co2.getValue().toString();
if ( ! name2.equals(coname2))
throw new Exception("2 - wrong name " + coname2 + " != " + name2);
if ( ! val2.equals(coval2))
throw new Exception("2 - wrong value " + coval2 + " != " + val2);
String coname3 = co3.getName().toString();
String coval3 = co3.getValue().toString();
if ( ! name3.equals(coname3))
throw new Exception("3 - wrong name " + coname3 + " != " + name3);
if ( ! val3.equals(coval3))
throw new Exception("3 - wrong value " + coval3 + " != " + val3);
String coname4 = co4.getName().toString();
String coval4 = co4.getValue().toString();
if ( ! name4.equals(coname4))
throw new Exception("4 - wrong name " + coname4 + " != " + name4);
if ( ! val4.equals(coval4))
throw new Exception("4 - wrong value " + coval4 + " != " + val4);
}