Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelPipeline


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

        @Override
        public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
        {
View Full Code Here


{

  @Override
  public void channelClosed(final ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
  {
    ChannelPipeline p = ctx.getPipeline();
    if (p instanceof StopablePipeline)
      ((StopablePipeline)p).stop();
  }
View Full Code Here

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

          @Override
          public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
          {
View Full Code Here

    //introspect connection to server
    Channel channel = conn._channel;
    SocketAddress clientAddr = channel.getLocalAddress();

    Channel serverChannel = _dummyServer.getChildChannel(clientAddr);
    ChannelPipeline serverPipeline = serverChannel.getPipeline();
    SimpleObjectCaptureHandler objCapture = (SimpleObjectCaptureHandler)serverPipeline.get("3");

    Assert.assertTrue(objCapture.waitForMessage(1000, 0));
    Object msgObj = objCapture.getMessages().get(0);
    Assert.assertTrue(msgObj instanceof HttpRequest);
View Full Code Here

        }

        final BlockingQueue<ChannelFuture> futureQueue =
            new LinkedBlockingQueue<ChannelFuture>();

        ChannelPipeline bossPipeline = pipeline();
        bossPipeline.addLast("binder", new Binder(localAddress, futureQueue));

        ChannelHandler parentHandler = getParentHandler();
        if (parentHandler != null) {
            bossPipeline.addLast("userHandler", parentHandler);
        }

        Channel channel = getFactory().newChannel(bossPipeline);

        // Wait until the future is available.
View Full Code Here

  }

  @Override
  public ChannelPipeline getPipeline() throws Exception
  {
    ChannelPipeline result = super.getPipeline();;

    result.addBefore(ExceptionListenerTestHandler.class.getSimpleName(),
                     ExtendedWriteTimeoutHandler.class.getSimpleName(),
                    new ExtendedWriteTimeoutHandler("client write timeout", null, 100, true));
    result.addFirst(SleepingDownstreamHandler.class.getName(),
                    new SleepingDownstreamHandler(_defaultSleep));

    return result;
  }
View Full Code Here

     * @throws IllegalStateException
     *         if {@link #setPipelineFactory(ChannelPipelineFactory)} was
     *         called by a user last time.
     */
    public ChannelPipeline getPipeline() {
        ChannelPipeline pipeline = this.pipeline;
        if (pipeline == null) {
            throw new IllegalStateException("pipelineFactory in use");
        }
        return pipeline;
    }
View Full Code Here

     * @throws IllegalStateException
     *         if {@link #setPipelineFactory(ChannelPipelineFactory)} is in
     *         use to create a new pipeline
     */
    public Map<String, ChannelHandler> getPipelineAsMap() {
        ChannelPipeline pipeline = this.pipeline;
        if (pipeline == null) {
            throw new IllegalStateException("pipelineFactory in use");
        }
        return pipeline.toMap();
    }
View Full Code Here

                    "pipelineMap is not an ordered map. " +
                    "Please use " +
                    LinkedHashMap.class.getName() + ".");
        }

        ChannelPipeline pipeline = pipeline();
        for(Map.Entry<String, ChannelHandler> e: pipelineMap.entrySet()) {
            pipeline.addLast(e.getKey(), e.getValue());
        }

        setPipeline(pipeline);
    }
View Full Code Here

     * Retrieve the channel pipeline factory.
     *
     * @see org.jboss.netty.channel.ChannelPipelineFactory#getPipeline()
     */
    public ChannelPipeline getPipeline() {
        final ChannelPipeline pipeline = pipeline();

        if (config.sslContext() != null) {
            SSLEngine e = config.sslContext().createSSLEngine();
            config.sslContextListener().onPostCreate(e);
            pipeline.addLast("ssl", new SslHandler(e));
        }

        pipeline.addLast("decoder", new HttpRequestDecoder());

        if (config.aggregateRequestBodyInMemory()) {
            pipeline.addLast("aggregator", new HttpChunkAggregator(config.maxChunkContentLength()));
        }

        pipeline.addLast("encoder", new HttpResponseEncoder());

        if (config.supportChunking()) {
            pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
        }

        for (ChannelUpstreamHandler h: config.channelUpstreamHandlers()) {
            pipeline.addLast(h.getClass().getName(), h);
        }

        pipeline.addLast(BridgeRuntime.class.getName(), bridgeRuntime);

        return pipeline;
    }
View Full Code Here

TOP

Related Classes of org.jboss.netty.channel.ChannelPipeline

Copyright © 2018 www.massapicom. 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.