Package org.apache.mina.transport.socket.nio

Examples of org.apache.mina.transport.socket.nio.SocketAcceptor.bind()


        FixedRandomInputStream stream = new FixedRandomInputStream( 4 * 1024 * 1024 );
       
        SenderHandler sender = new SenderHandler( stream );
        ReceiverHandler receiver = new ReceiverHandler( stream.size );
       
        acceptor.bind( address, sender );
       
        synchronized( sender.lock )
        {
            synchronized( receiver.lock )
            {
View Full Code Here


  public static void main(String[] args) throws IOException
  {
    ImageServerIoHandler handler = new ImageServerIoHandler();
    SocketAcceptor acceptor = new SocketAcceptor();
    acceptor.getFilterChain().addLast("protocol", new ProtocolCodecFilter(new ImageCodecFactory(false)));
    acceptor.bind(new InetSocketAddress(PORT), handler);
    System.out.println("server is listenig at port " + PORT);
  }

}
View Full Code Here

        if (USE_SSL) {
            addSSLSupport(chain);
        }

        // Bind
        acceptor.bind(new InetSocketAddress(PORT), new HttpProtocolHandler(),
                config);

        System.out.println("Listening on port " + PORT);
    }
View Full Code Here

                    "protocolFilter",
                    new ProtocolCodecFilter(
                            new HttpServerProtocolCodecFactory()));
            cfg.getFilterChain().addLast("logger", new LoggingFilter());

            acceptor
                    .bind(new InetSocketAddress(port), new ServerHandler(), cfg);

            System.out.println("Server now listening on port " + port);
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

                "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);
    }
}
View Full Code Here

                    new ProtocolCodecFilter(
                            new ObjectSerializationCodecFactory()));
        }
        cfg.getFilterChain().addLast("logger", new LoggingFilter());

        acceptor.bind(new InetSocketAddress(SERVER_PORT),
                new ServerSessionHandler(), cfg);

        System.out.println("Listening on port " + SERVER_PORT);
    }
}
View Full Code Here

        }

        addLogger(chain);

        // Bind
        acceptor.bind(new InetSocketAddress(PORT), new EchoProtocolHandler(),
                config);

        System.out.println("Listening on port " + PORT);
    }
View Full Code Here

            cfg.getFilterChain().addLast(
                    "protocolFilter",
                    new ProtocolCodecFilter( new HttpServerProtocolCodecFactory() ) );
            cfg.getFilterChain().addLast( "logger", new LoggingFilter() );

            acceptor.bind( new InetSocketAddress( port ), new ServerHandler(), cfg );

            System.out.println( "Server now listening on port " + port );
        }
        catch( Exception ex )
        {
View Full Code Here

        }
       
        addLogger( chain );
       
        // Bind
        acceptor.bind(
                new InetSocketAddress( PORT ),
                new EchoProtocolHandler(),
                config );

        System.out.println( "Listening on port " + PORT );
View Full Code Here

                "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 );
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.