Methods Summary |
---|
void | Test1()Body of the test 1.
Try to establish connection with wrong URI format.
SipConnectionNotifier scn = null;
try {
// try to create SipConnection object with SCTP transport
scn = (SipConnectionNotifier) Connector.open(
"sip:alice@atlanta.com;transport=sctp");
fail("IllegalArgumentException wasn't caused");
} catch (SipException e) {
if (e.getErrorCode() == SipException.TRANSPORT_NOT_SUPPORTED) {
assertTrue("OK", true);
} else {
fail("SipException was caused with wrong parameter");
}
} catch (Throwable e) {
fail("" +e +" was caused");
}
try {
// try to create SipConnection object with wrong URI
// user part is empty when '@' is present
scn = (SipConnectionNotifier) Connector.open("sip:@www.sun.com");
fail("IllegalArgumentException wasn't caused");
} catch (java.lang.IllegalArgumentException e) {
assertTrue("IllegalArgumentException was caused", true);
} catch (Throwable e) {
fail("" +e +" was caused");
}
try {
// try to create SipConnection object with wrong URI
// port format is wrong
scn = (SipConnectionNotifier)
Connector.open("sip:user@www.sun.com:abcd");
fail("IllegalArgumentException wasn't caused");
} catch (java.lang.IllegalArgumentException e) {
assertTrue("IllegalArgumentException was caused", true);
} catch (Throwable e) {
fail("" +e +" was caused");
}
try {
// try to create SipConnection object with wrong URI
// parameter name is not unique
scn = (SipConnectionNotifier)
Connector.open("sip:user@www.sun.com:1234;par1=val1;par1=val1");
fail("IllegalArgumentException wasn't caused");
} catch (java.lang.IllegalArgumentException e) {
assertTrue("IllegalArgumentException was caused", true);
} catch (Throwable e) {
fail("" +e +" was caused");
}
|
void | Test2()Create a SipConnectionNotifier and get local port and address
SipConnectionNotifier scn = null;
try {
// Open SIP server connection and listen to port 8888
scn = (SipConnectionNotifier) Connector.open("sip:8888");
} catch (Exception ex) {
assertNull("Exception during scn open", scn);
ex.printStackTrace();
}
assertNotNull("scn is null", scn);
try {
assertEquals("Local port is incorrect", scn.getLocalPort(), 8888);
} catch (IOException ioe) {
fail("IOException in getting local port or address");
}
try {
scn.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
|
void | Test3()Create a SipConnectionNotifier with "transport=tcp"
SipConnectionNotifier scn = null;
try {
// Open SIP server connection and listen to port 9999
scn = (SipConnectionNotifier) Connector.open(
"sip:9999;transport=tcp");
assertNotNull("scn is null", scn);
scn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
|
void | Test4()Create a SipConnectionNotifier with explicite "transport=udp"
SipConnectionNotifier scn = null;
try {
// Open SIP server connection and listen to port 4444
scn = (SipConnectionNotifier) Connector.open(
"sip:8889");
assertNotNull("scn is null", scn);
scn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
|
void | Test5()Create a SipConnectionNotifier with explicite "sip:"
SipConnectionNotifier scn = null;
try {
// Open SIP server connection and listen to port 4444
scn = (SipConnectionNotifier) Connector.open(
"sip:");
assertNotNull("scn is null", scn);
scn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
|
void | Test6()Create a SipConnectionNotifier with explicite "sip:;transport=tcp"
SipConnectionNotifier scn = null;
try {
// Open SIP server connection and listen to port 4444
scn = (SipConnectionNotifier) Connector.open(
"sip:;transport=tcp");
assertNotNull("scn is null", scn);
scn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
|
public void | runTests()Tests execute
declare("Wrong URI format");
Test1();
declare("SCN Methods");
Test2();
declare("TCP Transport");
Test3();
declare("UDP Transport");
Test4();
declare("sip:");
Test5();
declare("sip:;transport=tcp");
Test6();
|