{
private static final int PORT = 8080;
public static void main( String[] args ) throws Exception
{
IoAcceptor acceptor = new SocketAcceptor();
// Prepare the configuration
SocketAcceptorConfig cfg = new SocketAcceptorConfig();
cfg.setReuseAddress( true );
cfg.getFilterChain().addLast( "logger", new LoggingFilter() );
cfg.getFilterChain().addLast(
"codec",
new ProtocolCodecFilter(
new TextLineCodecFactory( Charset.forName( "UTF-8" ) ) ) );
// Bind
acceptor.bind(
new InetSocketAddress( PORT ),
new ReverseProtocolHandler(), cfg );
System.out.println( "Listening on port " + PORT );
}