01: /**
02: * $RCSfile$
03: * $Revision: 70 $
04: * $Date: 2004-10-22 15:35:36 -0200 (sex, 22 out 2004) $
05: *
06: * Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
07: *
08: * This software is the proprietary information of CoolServlets, Inc.
09: * Use is subject to license terms.
10: */package org.jivesoftware.util;
11:
12: import junit.framework.TestCase;
13: import org.jivesoftware.openfire.stun.StunServerAddress;
14:
15: import java.util.List;
16: import java.util.ArrayList;
17:
18: public class STUNServerTest extends TestCase {
19:
20: public void testEqualsStunServerAddress() {
21:
22: StunServerAddress addr0 = new StunServerAddress("apollo",
23: "10000");
24: StunServerAddress addr1 = new StunServerAddress("apollo",
25: "10000");
26: StunServerAddress addr2 = new StunServerAddress(
27: "63.246.20.124", "10002");
28: StunServerAddress addr3 = new StunServerAddress(
29: "jivesoftware.com", "10002");
30: StunServerAddress addr4 = new StunServerAddress(
31: "jivesoftware.com", "10003");
32:
33: assertTrue(addr0.equals(addr1));
34: assertFalse(addr0.equals(addr2));
35: assertTrue(addr2.equals(addr3));
36: assertFalse(addr3.equals(addr4));
37:
38: List<StunServerAddress> list = new ArrayList<StunServerAddress>();
39: list.add(addr0);
40: list.add(addr1);
41: list.add(addr2);
42: list.add(addr4);
43: assertTrue(list.contains(addr3));
44:
45: }
46:
47: }
|