Examples of ChannelPipelineFactory


Examples of com.facebook.presto.jdbc.internal.netty.channel.ChannelPipelineFactory

     * does the connect to SOCKS proxy and does the handshake.
     */
    @Override
    public ChannelPipelineFactory getPipelineFactory()
    {
        return new ChannelPipelineFactory()
        {
            @Override
            public ChannelPipeline getPipeline()
                    throws Exception
            {
View Full Code Here

Examples of io.netty.channel.ChannelPipelineFactory

            // HttpResponseDecoder to WebSocketHttpResponseDecoder in the pipeline.
            final WebSocketClientHandshaker handshaker =
                    new WebSocketClientHandshakerFactory().newHandshaker(
                            uri, WebSocketVersion.V13, null, false, customHeaders);
           
            bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
                public ChannelPipeline getPipeline() throws Exception {
                    ChannelPipeline pipeline = Channels.pipeline();
   
                    // If you wish to support HyBi V00, you need to use
                    // WebSocketHttpResponseDecoder instead for
View Full Code Here

Examples of org.elasticsearch.common.netty.channel.ChannelPipelineFactory

                    Executors.newCachedThreadPool(daemonThreadFactory(settings, "memcached_server_boss")),
                    Executors.newCachedThreadPool(daemonThreadFactory(settings, "memcached_server_worker")),
                    workerCount));
        }

        ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() {
            @Override public ChannelPipeline getPipeline() throws Exception {
                ChannelPipeline pipeline = Channels.pipeline();
                pipeline.addLast("openChannels", serverOpenChannels);
                pipeline.addLast("decoder", new MemcachedDecoder(logger));
                pipeline.addLast("dispatcher", new MemcachedDispatcher(restController));
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipelineFactory

        // Configure the server.
        bootstrap = new ServerBootstrap();

        // Set up the event pipeline factory.
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            @Override
            public ChannelPipeline getPipeline() throws Exception {
                long timestamp = timestamp();
                Object id = nextId();
                ChannelPipeline pipeline = pipeline();
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipelineFactory

private static Executor executor = Executors.newCachedThreadPool();


public void init() throws Exception
{
  ChannelPipelineFactory factory = new ChannelPipelineFactory()
  {
    public ChannelPipeline getPipeline() throws Exception
    {
      ChannelPipeline pipeline = pipeline();
      pipeline.addLast("discoveryServer", new SimpleChannelUpstreamHandler()
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipelineFactory

  public void init() throws Exception
  {
    if (host == null)
      host = whatIsMyIp();

    ChannelPipelineFactory factory = new ChannelPipelineFactory()
    {
      public ChannelPipeline getPipeline() throws Exception
      {
        ChannelPipeline pipeline = pipeline();
        pipeline.addLast("discoveryServer", new SimpleChannelUpstreamHandler()
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipelineFactory

                    Executors.newCachedThreadPool(),
                    Executors.newCachedThreadPool());

        ServerBootstrap bootstrap = new ServerBootstrap(factory);
       
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() {
                return Channels.pipeline(new SimpleChannelUpstreamHandler()
                {
            @Override
            public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
            {
              if (mcast != null && mcast.isInit())
                mcast.send((ChannelBuffer) e.getMessage());
            }
           
            @Override
              public void childChannelOpen(ChannelHandlerContext ctx, ChildChannelStateEvent e)
            {
              remoteChannels.add(ctx.getChannel());
              }
           
            @Override
              public void childChannelClosed(ChannelHandlerContext ctx, ChildChannelStateEvent e)
            {
              remoteChannels.add(ctx.getChannel());
              }
           
            @Override
              public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
                  Throwable cause = e.getCause();
                  System.out.println(e);           
              }
                });
            }
        });
        bootstrap.bind(new InetSocketAddress(port));
       
        try
    {
      mcast.init(new ChannelPipelineFactory() {
          public ChannelPipeline getPipeline() {
              return Channels.pipeline(new SimpleChannelUpstreamHandler()
              {
            @Override
            public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipelineFactory

        bootstrap = new ClientBootstrap(factory);
        bootstrap.setOption(
                "remoteAddress", new InetSocketAddress(host, port));

        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() {
                return Channels.pipeline(new SimpleChannelUpstreamHandler()
                {
            @Override
            public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
            {
              if (mcast != null && mcast.isInit())
                mcast.send((ChannelBuffer) e.getMessage());
            }
           
            @Override
              public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) {
                  timer.schedule(new TimerTask() {
                      public void run() {
                           bootstrap.connect();
                      }
                  }, RECONNECT_DELAY);
              }
           
            @Override
              public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
                  Throwable cause = e.getCause();
                  if (cause instanceof ConnectException)
                  {
                    System.out.println("conection lost: reconnecting...");
                  }
                  ctx.getChannel().close();
              }


                 
                });
            }
        });
       
        ChannelFuture f = bootstrap.connect();
        channel = f.getChannel();
       
        mcast.init(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() {
                return Channels.pipeline(new SimpleChannelUpstreamHandler()
                {
            @Override
            public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipelineFactory

     * {@inheritDoc}
     */
    public void start(int port) throws IOException {
        factory = new NioDatagramChannelFactory();
        ConnectionlessBootstrap bootstrap = new ConnectionlessBootstrap(factory);
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() throws Exception {
                return Channels.pipeline(new SimpleChannelUpstreamHandler() {
                    @Override
                    public void childChannelOpen(ChannelHandlerContext ctx, ChildChannelStateEvent e) throws Exception {
                        System.out.println("childChannelOpen");
View Full Code Here

Examples of org.jboss.netty.channel.ChannelPipelineFactory

    public void start(final int port, final CountDownLatch counter, final byte[] data) throws IOException {
        factory = new NioDatagramChannelFactory();
        ConnectionlessBootstrap bootstrap = new ConnectionlessBootstrap(factory);
        bootstrap.setOption("sendBufferSize", 65536);
        bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(9000));
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() throws Exception {
                return Channels.pipeline(new SimpleChannelUpstreamHandler() {
                    private void sendMessage(ChannelHandlerContext ctx, byte[] data) {
                        ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(data);
                        ctx.getChannel().write(buffer);
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.