Methods Summary |
---|
void | cleanUp()Provide clean-up services, following the run of this test.
closeConnection();
|
private void | closeConnection()Close the CBS connection.
try {
con.close();
} catch (IOException ioe) {
// Fail silently.
} catch (Exception e) {
// Fail silently.
}
|
private void | createClientConnection(java.lang.String clientAddress)Create and open an CBS connection.
con = (MessageConnection)Connector.open(clientAddress);
|
public void | run()Simply close the open connection. If successful, this test passes.
try {
closeConnection();
/*
* Close connection again. This is allowed by the spec
* and shouldn't cause any exceptions to be thrown.
*/
closeConnection();
passed = true;
assertTrue("This indicates we passed.", passed);
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
|
public void | runTests()Main entry point.
setUp();
declare(TEST_NAME);
run();
cleanUp();
|
void | setUp()Set up the physical connection.
// Try an illegal address first.
try {
createClientConnection(CBS_CLIENT_ADDRESS1);
} catch (IllegalArgumentException iae) {
// This is a good thing. Cannot have a host name in address.
} catch (IOException ioe) {
System.out.println(TEST_NAME + " set-up failed:");
ioe.printStackTrace();
}
// Now try a legal address.
try {
createClientConnection(CBS_CLIENT_ADDRESS2);
} catch (IOException ioe) {
System.out.println(TEST_NAME + " set-up failed:");
ioe.printStackTrace();
}
|