public void testStart() {
    // remove this comments to test this class standalone
    //		jxmeService.initComponent();
    //		jxmeService.startComponent(null);
    jxmeService.addMessageListener(new TestListener());
    if (LOG.isDebugEnabled()) {
      LOG.debug("adding IMessageListener to JxmeService");
    }

    LOG.info("JUNIT: init BluetoothComponent");
    //		btcop.initComponent();
    //		btcop.startComponent(null);
    assertTrue(true);

    if (btcop.isRendezVousPeer()) {
      while (btcop.numberOfConnections() == 0) {
        synchronized (this) {
          try {
            this.wait(1000);
          } catch (InterruptedException e) {
            LOG.error("interrupted during waiting for incomming messages", e);
          }
        }
      }
      IElement[] elements = new Element[1];
      elements[0] = new Element("test", "test");
      IMessage msg = new Message(elements);

      try {
        jxmeService.send(null, msg);
        if (LOG.isDebugEnabled()) {
          LOG.debug("============> sent message");
        }
      } catch (IOException e) {
        LOG.fatal("IOException during sending message: ", e);
      }
    } else {
      synchronized (this) {
        try {
          this.wait(30000);
        } catch (InterruptedException e) {
          LOG.error("interrupted during waiting for incomming messages", e);
        }
      }
    }
    synchronized (this) {
      try {
        this.wait(3000);
      } catch (InterruptedException e) {
        LOG.error("interrupted during waiting for incomming messages", e);
      }
    }
  }
/**
 * @author daniel
 *     <p>To change the template for this generated type comment go to
 *     Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class TestBluetoothService extends TestCase implements IComponent {

  private static Logger LOG = Logger.getLogger(TestBluetoothService.class);

  private static TestBluetoothService testJxmeService = null;

  private JxmeService jxmeService = JxmeService.Instance();
  private BluetoothService btcop = BluetoothService.Instance();

  private TestBluetoothService() {}

  public TestBluetoothService(String arg) {
    super(arg);
  }

  /* singleton */
  public static TestBluetoothService Instance() {
    if (testJxmeService == null) {
      testJxmeService = new TestBluetoothService();
    }
    return testJxmeService;
  }

  /* *******************************************************************************	*/
  /* Component																										*/
  /* *******************************************************************************	*/

  public void initComponent() {
    if (LOG.isInfoEnabled()) {
      LOG.info("Initialize TestJxmeServiceAopAspectJ");
    }
  }

  public void startComponent(String[] args) {
    if (LOG.isInfoEnabled()) {
      LOG.info("Start TestJxmeServiceAopAspectJ");
    }
    junit.textui.TestRunner.run(TestBluetoothService.class);
  }

  public void stopComponent() {
    if (LOG.isInfoEnabled()) {
      LOG.info("Stop TestJxmeServiceAopAspectJ");
    }
    return;
  }

  /* ******************************************************************************* 	*/
  /* TestCase                                                                                                       	*/
  /* ******************************************************************************* 	*/

  public void setUp() {}

  public void tearDown() {
    return;
  }

  public void testCreation() {
    LOG.info("JUNIT: testeCreation");
    assertTrue(true);
  }

  public void testInit() {
    LOG.info("JUNIT: init BluetoothComponent");
    assertTrue(true);
  }

  public void testStart() {
    // remove this comments to test this class standalone
    //		jxmeService.initComponent();
    //		jxmeService.startComponent(null);
    jxmeService.addMessageListener(new TestListener());
    if (LOG.isDebugEnabled()) {
      LOG.debug("adding IMessageListener to JxmeService");
    }

    LOG.info("JUNIT: init BluetoothComponent");
    //		btcop.initComponent();
    //		btcop.startComponent(null);
    assertTrue(true);

    if (btcop.isRendezVousPeer()) {
      while (btcop.numberOfConnections() == 0) {
        synchronized (this) {
          try {
            this.wait(1000);
          } catch (InterruptedException e) {
            LOG.error("interrupted during waiting for incomming messages", e);
          }
        }
      }
      IElement[] elements = new Element[1];
      elements[0] = new Element("test", "test");
      IMessage msg = new Message(elements);

      try {
        jxmeService.send(null, msg);
        if (LOG.isDebugEnabled()) {
          LOG.debug("============> sent message");
        }
      } catch (IOException e) {
        LOG.fatal("IOException during sending message: ", e);
      }
    } else {
      synchronized (this) {
        try {
          this.wait(30000);
        } catch (InterruptedException e) {
          LOG.error("interrupted during waiting for incomming messages", e);
        }
      }
    }
    synchronized (this) {
      try {
        this.wait(3000);
      } catch (InterruptedException e) {
        LOG.error("interrupted during waiting for incomming messages", e);
      }
    }
  }

  class TestListener implements IMessageListener {

    public void processMessage(IMessage msg) {
      LOG.info("===>\t\tGOT MESSAGE:\n" + msg.toXMLString());
    }
  }
}