Package io.netty.channel

Examples of io.netty.channel.Channel


      {
         HornetQServerLogger.LOGGER.nettyChannelGroupBindError();
         Iterator<Channel> iterator = future.group().iterator();
         while (iterator.hasNext())
         {
            Channel channel = iterator.next();
            if (channel.isActive())
            {
               HornetQServerLogger.LOGGER.nettyChannelStillBound(channel, channel.remoteAddress());
            }
         }
      }
      paused = true;
   }
View Full Code Here


         }
         else
         {
            address = new InetSocketAddress(h, port);
         }
         Channel serverChannel = bootstrap.bind(address).syncUninterruptibly().channel();
         serverChannelGroup.add(serverChannel);
      }
   }
View Full Code Here

      {
         HornetQServerLogger.LOGGER.nettyChannelGroupError();
         Iterator<Channel> iterator = future.group().iterator();
         while (iterator.hasNext())
         {
            Channel channel = iterator.next();
            if (channel.isActive())
            {
               HornetQServerLogger.LOGGER.nettyChannelStillOpen(channel, channel.remoteAddress());
            }
         }
      }

      eventLoopGroup.shutdown();
View Full Code Here

      {
         HornetQServerLogger.LOGGER.nettyChannelGroupBindError();
         Iterator<Channel> iterator = future.group().iterator();
         while (iterator.hasNext())
         {
            Channel channel = iterator.next();
            if (channel.isActive())
            {
               HornetQServerLogger.LOGGER.nettyChannelStillBound(channel, channel.remoteAddress());
            }
         }
      }
      paused = true;
   }
View Full Code Here

    // Set up the event pipeline factory.
    bootstrap.setPipelineFactory(factory);

    // Bind and start to accept incoming connections.
    final Channel server = bootstrap.bind(new InetSocketAddress(port));

    svc.addShutdownHook(new Runnable() {
      @Override
      public void run() {
        bootstrap.releaseExternalResources();
        factory.getWebSocketServerHandler().stop();
        server.close();
        svc = null;
        log.info("web socket server stopped.");
      }
    });
View Full Code Here

        } else {
            return null;
        }

        EventLoopGroup eventLoopGroup = process.getEventLoop().getEventLoopGroup();
        Channel channel = NioOutputStreamChannel.create(process, out);
        channel.config().setAutoRead(false);
        channel.pipeline().addLast( new DataEventHandler( process, handle ));
        eventLoopGroup.register(channel);

        return channel.newSucceededFuture();
    }
View Full Code Here

    public static ChannelFuture create(NodeProcess process, int fd, StreamWrap handle) throws IOException {
        if (fd == 0) {
            InputStream in = System.in;
            EventLoopGroup eventLoopGroup = process.getEventLoop().getEventLoopGroup();

            Channel channel = NioInputStreamChannel.create(process, in);
            channel.config().setAutoRead(false);
            channel.pipeline().addLast( new DataEventHandler( process, handle ) );
            eventLoopGroup.register(channel);

            return channel.newSucceededFuture();
        }

        return null;
    }
View Full Code Here

    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        ByteBuf buf = (ByteBuf) msg;
        Channel ch = ctx.channel();
        try {
            if (!firstPass) {
               readHeader(buf);
            } else {
               firstPass = false;
            }
            byte[] bytes = readBytes(buf);
            byte[] challenge = server.evaluateResponse(bytes);
            if (!server.isComplete()) {
                ch.writeAndFlush(newContinueMessage(ctx, Unpooled.wrappedBuffer(challenge)));
            } else {
                ch.writeAndFlush(newSuccessMessage(ctx, Unpooled.wrappedBuffer(challenge)));

                ChannelPipeline pipeline = ctx.pipeline();
                String qop = (String) server.getNegotiatedProperty(Sasl.QOP);
                if (qop != null
                        && (qop.equalsIgnoreCase(AUTH_INT)
                        || qop.equalsIgnoreCase(AUTO_CONF))) {
                    SaslServer server = this.server;
                    this.server = null;
                    // Replace this handler now with the QopHandler
                    // This is mainly done as the QopHandler itself will not block at all and so we can
                    // get rid of the usage of the EventExecutorGroup after the negation took place.
                    pipeline.replace(this, ctx.name(), new QopHandler(server));
                } else {
                    // there is no need for any QOP handling so we are done now and can just remove ourself from the
                    // pipeline
                    pipeline.remove(this);
                }
            }
        } catch (SaslException e) {
            Object errorMsg = newErrorMessage(ctx, e);
            if (errorMsg != null) {
                ch.writeAndFlush(errorMsg).addListener(ChannelFutureListener.CLOSE);
            }
        }
    }
View Full Code Here

                    channel.pipeline().addLast(new TestServerHandler());
                };
            });
            ChannelFuture bindFuture = bootstrap.bind();
            bindFuture.sync();
            Channel channel = bindFuture.channel();
            ChannelFuture closeFuture = channel.closeFuture();
            //closeFuture.sync();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
View Full Code Here

            }
        }

        // Remove the entry when the channel closes.
        if (e instanceof ChannelStateEvent) {
            Channel channel = e.getChannel();
            ChannelStateEvent se = (ChannelStateEvent) e;
            if (se.getState() == ChannelState.OPEN &&
                !channel.isOpen()) {
                removeChildExecutor(key);
            }
        }
        return executor;
    }
View Full Code Here

TOP

Related Classes of io.netty.channel.Channel

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.