ProtocolPushImpl pushImpl = null;
int i = 0;
exceptionThrownAsExpected = true;
try {
pushImpl = (ProtocolPushImpl)ProtocolPush.getInstance(connection);
}
catch (Exception cce) {
exceptionThrownAsExpected = false;
}
if (exceptionThrownAsExpected) {
for (i = negativeFilters.length; --i >= 0 && exceptionThrownAsExpected; ) {
exceptionThrownAsExpected = false;
try {
pushImpl.checkRegistration(connection,
"com.sun.midp.io.j2me.socket.TestPushRegistry.MyTestMIDlet",
negativeFilters[i]);
System.err.println("failed with no exception at " + negativeFilters[i]);
}
catch (IllegalArgumentException iae) {
exceptionThrownAsExpected = true;
}
catch (Exception ex) {
System.err.println("failed with " + ex + " at " + negativeFilters[i]);
}
}
}
if (exceptionThrownAsExpected) {
try {
for (i = positiveFilters.length; --i >= 0 && exceptionThrownAsExpected; ) {
pushImpl.checkRegistration(connection,
"com.sun.midp.io.j2me.socket.TestPushRegistry.MyTestMIDlet",
positiveFilters[i]);
}
}
catch (Exception ex) {
System.err.println("failed with " + ex + " at " + positiveFilters[i]);
exceptionThrownAsExpected = false;
}
}
assertTrue("Verify PushRegistry for socket connection", exceptionThrownAsExpected);