//    @Test
  public void testJoin() throws Exception {
    assertEquals(ConnectionState.NULL, connection.getState());
    connection.bind();
    Thread.sleep(500);

    connection.join();

    Thread.sleep(1000);
    assertEquals(ConnectionState.OPEN, connection.getState());
    assertTrue("Listener did not receive event", openState);
  }
  //    @Test
  public void testTimeout() throws Exception {
    //        assertEquals(ConnectionState.NULL, connection.getState());
    //        connection.bind();

    Thread.sleep(10000);
    assertEquals(ConnectionState.NULL, connection.getState());
  }
  public void process(ConnectionEvent event) {
    if (event.getId() == ConnectionEvent.STATE_CHANGE) {
      BaseConnection conn = (BaseConnection) event.getSource();

      if (conn.getState() == ConnectionState.HALF_OPEN) {
        halfOpenState = true;
      }

      if (conn.getState() == ConnectionState.OPEN) {
        openState = true;
      }

      if (conn.getState() == ConnectionState.NULL) {
        nullState = true;
      }
    }
  }
  //    @Test
  public void testBind() throws Exception {
    //        assertEquals(ConnectionState.NULL, connection.getState());
    //        connection.bind();

    Thread.sleep(1000);
    assertEquals(ConnectionState.HALF_OPEN, connection.getState());
    assertTrue("Listener did not receive event", halfOpenState);
  }
  @Before
  public void setUp()
      throws ResourceUnavailableException, IOException, TooManyConnectionsException {
    // use default clock
    clock = new WallClock();

    // create single thread scheduler
    scheduler = new PriorityQueueScheduler();
    scheduler.setClock(clock);
    scheduler.start();

    channelsManager = new ChannelsManager(new UdpManager(new ServiceScheduler()));
    channelsManager.setScheduler(scheduler);

    resourcesPool = new ResourcesPool(scheduler, channelsManager, dspFactory);
    // assign scheduler to the endpoint
    endpoint = new MyTestEndpoint("test");
    endpoint.setScheduler(scheduler);
    endpoint.setResourcesPool(resourcesPool);
    endpoint.start();

    connection = (BaseConnection) endpoint.createConnection(ConnectionType.LOCAL, false);
    connection.addListener(this);
  }
 //    @Test
 public void testGetEndpoint() {
   assertEquals(endpoint, connection.getEndpoint());
 }
 //    @Test
 public void testGetState() {
   assertEquals(ConnectionState.NULL, connection.getState());
 }