FileDocCategorySizeDatePackage
TestConnectionSuspend.javaAPI DocphoneME MR2 API (J2ME)4456Wed May 02 18:00:10 BST 2007com.sun.midp.suspend

TestConnectionSuspend

public class TestConnectionSuspend extends com.sun.midp.i3test.TestCase
Tests connection behavior within suspend/resume cycles.

Fields Summary
private Side
server
private Side
client
Constructors Summary
Methods Summary
private voidinit()

        TestUtil.setNoVMSuspendMode();
        server = new ServerSide();
        TestUtil.sleep(1000);
        client = new ClientSide();
        client.waitReady();
        server.waitReady();
    
public voidrunTests()

        init();

        declare("Test connection before Suspend");

        assertTrue("positive write", client.canWrite());
        assertTrue("positive read", server.canRead());

        declare("Test connection after Suspend");
        TestUtil.suspendMidp();
        TestUtil.sleep();

        assertTrue("negative write", !client.canWrite());
        assertTrue("negative read", !server.canRead());

        declare("Test connection after Resume");
        TestUtil.resumeMidp();
        TestUtil.sleep();

        assertTrue("negative write2", !client.canWrite());
        assertTrue("negative read2", !server.canRead());