Version 1

    JBossAS 5.1.0 and later include a deployer for network applications which use XNIO directly.  Here's the steps for using it (this example is a TCP server).


    1. Write a class that implements IoHandlerFactory<TcpChannel>.  Your application will need to depend on the XNIO API JAR which you can download from the project page.
    2. Write a jboss-beans.xml file like so:
      <?xml version="1.0" encoding="UTF-8"?>
      <deployment xmlns="urn:jboss:bean-deployer:2.0">
          <!-- This is your class that you wrote above -->
          <bean name="MyHandlerFactory" class="com.your.handler.ClassName"/>
          <xnio xmlns="urn:jboss:xnio:1.0">
              <tcp-server name="MyTcpServer">
                  <handler-factory-bean name="MyHandlerFactory"/>
                  <!-- Use the command-line JBoss bind address -->
                  <bind-address address="${jboss.bind.address}" port="1234"/>
    3. Package your JAR, including your classes in the normal place, and put the jboss-beans.xml file in the META-INF area.
    4. Deploy your JAR by copying it into the deploy/ directory in your chosen server profile.


    That's it!