Package com.sun.sgs.client.simple

Examples of com.sun.sgs.client.simple.SimpleClient$SimpleClientConnectionListener


        setStatus("Not Started");
        c.add(statusLabel, BorderLayout.SOUTH);
        setSize(640, 480);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setVisible(true);
        simpleClient = new SimpleClient(this);
    }
View Full Code Here


    {
        logger.info("Test good session");

        // create the client & login
        GoodSessionListener listener = new GoodSessionListener(username, password);
        SimpleClient sc = new SimpleClient(listener);
        listener.setSession(sc);
       
        // log in
        Properties props = new Properties();
        props.setProperty("host", serverInfo.getHostname());
        props.setProperty("port", Integer.toString(serverInfo.getSgsPort()));
        sc.login(props);

        boolean success = listener.waitForLogin();
        assert success : "Good login failed";
       
        sc.logout(true);
    }
View Full Code Here

    {
        logger.info("Test bad session");
       
        // create the client & login
        BadSessionListener listener = new BadSessionListener(username, password);
        SimpleClient sc = new SimpleClient(listener);
        listener.setSession(sc);
       
        // log in
        Properties props = new Properties();
        props.setProperty("host", serverInfo.getHostname());
        props.setProperty("port", Integer.toString(serverInfo.getSgsPort()));
        sc.login(props);

        boolean success = listener.waitForLogin();
        assert !success : "Bad login succeeded";
       
        sc.logout(true);
    }
View Full Code Here

            }
           
            startLogin(loginParams);
        }
       
        simpleClient = new SimpleClient(new WonderlandClientListener());
       
        Properties connectProperties = new Properties();
        connectProperties.setProperty("host", server.getHostname());
        connectProperties.setProperty("port", Integer.toString(server.getSgsPort()));
       
View Full Code Here

        setStatus("Not Started");
        c.add(statusLabel, BorderLayout.SOUTH);
        setSize(640, 480);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setVisible(true);
        simpleClient = new SimpleClient(this);
    }
View Full Code Here

    }

    // Helpers
   
    void connect(SimpleClientListener listener) throws IOException {
        client = new SimpleClient(listener);
        client.login(connectionProps);
    }
View Full Code Here

    // disconnected callback (but not a loginFailed callback).
    public void testLoginNoServer() throws Exception {
  DummySimpleClientListener listener =
      new DummySimpleClientListener();

  SimpleClient client = new SimpleClient(listener);
  Properties props =
      createProperties(
    "host", "localhost",
    "port", Integer.toString(5382),
    "connectTimeout", Long.toString(TIMEOUT));
  client.login(props);
  synchronized (client) {
      client.wait(TIMEOUT * 2);
  }
  assertTrue(listener.disconnected);
  assertEquals(0, listener.getPasswordAuthentication);
  if (listener.disconnectReason == null) {
      fail("Received null disconnect reason");
View Full Code Here

    public void testLoginFailedCallback() throws Exception {
  DummySimpleClientListener listener =
      new DummySimpleClientListener(
     new PasswordAuthentication("guest", new char[] {'!'}));

  SimpleClient client = new SimpleClient(listener);
  int port = 5382;
  Properties props =
      createProperties(
    "host", "localhost",
    "port", Integer.toString(port),
    "connectTimeout", Long.toString(TIMEOUT));
  SimpleServer server = new SimpleServer(port);
  try {
      server.start();
      client.login(props);
      synchronized (client) {
    client.wait(TIMEOUT);
      }
      assertTrue(listener.loginFailed);
      if (listener.loginFailedReason == null) {
    fail("Didn't receive loginFailed callback");
      }
View Full Code Here

    public void testLoggedInCallback() throws Exception {
  DummySimpleClientListener listener =
      new DummySimpleClientListener(
    new PasswordAuthentication("guest", password));

  SimpleClient client = new SimpleClient(listener);
  int port = 5383;
  Properties props =
      createProperties(
    "host", "localhost",
    "port", Integer.toString(port),
    "connectTimeout", Long.toString(TIMEOUT));
  SimpleServer server = new SimpleServer(port);
  try {
      server.start();
      client.login(props);
      synchronized (client) {
    client.wait(TIMEOUT);
      }
      assertTrue(listener.loggedIn);
  } finally {
      server.shutdown();
  }
View Full Code Here

    public void testLoginObtainsPasswordAuthentication() throws Exception {
  DummySimpleClientListener listener =
      new DummySimpleClientListener(
    new PasswordAuthentication("guest", password));

  SimpleClient client = new SimpleClient(listener);
  int port = 5383;
  Properties props =
      createProperties(
    "host", "localhost",
    "port", Integer.toString(port),
    "connectTimeout", Long.toString(TIMEOUT));
  SimpleServer server = new SimpleServer(port);
  try {
      server.start();
      client.login(props);
      synchronized (client) {
    client.wait(TIMEOUT);
      }
      assertEquals(1, listener.loggedInCount);
      assertEquals(1, listener.getPasswordAuthentication);
     
      client.logout(false);
      synchronized (client) {
    client.wait(TIMEOUT);
      }
      assertTrue(listener.disconnected);
      assertTrue(listener.disconnectGraceful);
     
      client.login(props);
      synchronized (client) {
    client.wait(TIMEOUT);
      }
      assertEquals(2, listener.loggedInCount);
      assertEquals(2, listener.getPasswordAuthentication);
     
  } finally {
View Full Code Here

TOP

Related Classes of com.sun.sgs.client.simple.SimpleClient$SimpleClientConnectionListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.