Package com.rubyeventmachine.tests

Source Code of com.rubyeventmachine.tests.EMTest

/**
* $Id$
*
* Author:: Francis Cianfrocca (gmail: blackhedd)
* Homepage::  http://rubyeventmachine.com
* Date:: 15 Jul 2007
*
* See EventMachine and EventMachine::Connection for documentation and
* usage examples.
*
*
*----------------------------------------------------------------------------
*
* Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
* Gmail: blackhedd
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of either: 1) the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version; or 2) Ruby's License.
*
* See the file COPYING for complete licensing information.
*
*---------------------------------------------------------------------------
*
*
*/


package com.rubyeventmachine.tests;

//import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.rubyeventmachine.EmReactor;

import java.io.*;
import java.nio.*;


public class EMTest {

  class ShortTimer extends EmReactor {
    public void eventCallback (String sig, int eventCode, ByteBuffer data) {
      System.out.println ("Short Callback "+sig+" "+eventCode+" "+data);
      this.stop();
    }
  }
 
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
  }

  @AfterClass
  public static void tearDownAfterClass() throws Exception {
  }

  @Before
  public void setUp() throws Exception {
  }

  @After
  public void tearDown() throws Exception {
  }

  @Test
  public final void testOneShort() throws IOException {
    EmReactor em = new ShortTimer();
    em.installOneshotTimer(1050);
    em.run();
  }
 

}
TOP

Related Classes of com.rubyeventmachine.tests.EMTest

TOP
Copyright © 2018 www.massapi.com. 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.