package it.rafa.test; import it.rafa.filters.StringParserFilter; import java.io.IOException; import org.glassfish.grizzly.filterchain.FilterChainBuilder; import org.glassfish.grizzly.filterchain.TransportFilter; import org.glassfish.grizzly.nio.transport.TCPNIOTransport; import org.glassfish.grizzly.nio.transport.TCPNIOTransportBuilder; public class TCPServerMTTest { public static int PORT=9999; public static String HOST="localhost"; public static void main(String[] args) { final TCPNIOTransport transport1 = TCPNIOTransportBuilder.newInstance().build(); try { //filterchain FilterChainBuilder filterChainBuilder = FilterChainBuilder.stateless(); filterChainBuilder.add(new TransportFilter()); filterChainBuilder.add(new MyProtocolFilter() ); filterChainBuilder.add(new MyCallerFilter() ); transport1.setProcessor(filterChainBuilder.build()); transport1.start(); transport1.bind( PORT ); System.out.println("Press any key to stop the example..."); System.in.read(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(1); } finally { try { transport1.stop(); } catch (IOException ignored) {} } } }