Package io.netty.channel

Examples of io.netty.channel.ChannelFuture.channel()


            allChannels.add(datagramChannel);
        } else {
            LOG.info("ConnectionlessBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
            ChannelFuture channelFuture = bootstrap.bind(hostAddress);
            channelFuture.awaitUninterruptibly();
            channel = channelFuture.channel();
            allChannels.add(channel);
        }
    }

    protected void stopServerBootstrap() {
View Full Code Here


            // set the pipeline factory, which creates the pipeline for each newly created channels
            connectionlessClientBootstrap.handler(pipelineFactory);
            // bind and store channel so we can close it when stopping
            ChannelFuture channelFuture = connectionlessClientBootstrap.bind(new InetSocketAddress(0));
            channelFuture.awaitUninterruptibly();
            Channel channel = channelFuture.channel();
            allChannels.add(channel);
            answer = connectionlessClientBootstrap.connect(new InetSocketAddress(configuration.getHost(), configuration.getPort()));

            if (LOG.isDebugEnabled()) {
                LOG.debug("Created new UDP client bootstrap connecting to {}:{} with options: {}",
View Full Code Here

        });

        // Bind and start to accept incoming connections.
        ChannelFuture f = b.bind(port).sync();

        serverChannel = f.channel();

        logger.info("Netty server started on port "+port);

        // Wait until the server socket is closed.
        //serverChannel.closeFuture().sync();
View Full Code Here

      svc.addShutdownHook(new Runnable() {
        @Override
        public void run() {
          try {
            webSocketHandler.stop();
            channelFuture.channel().close();
            log.info("web socket server stopped.");
          }
          catch (Exception e) {
            throw new RuntimeException(e);
          }
View Full Code Here

        return doBind(localAddress);
    }

    private ChannelFuture doBind(final SocketAddress localAddress) {
        final ChannelFuture regFuture = initAndRegister();
        final Channel channel = regFuture.channel();
        if (regFuture.cause() != null) {
            return regFuture;
        }

        if (regFuture.isDone()) {
View Full Code Here

      Bootstrap clientBootstrap = sharedRef.get().getBootstrap();

      ChannelFuture connectFuture = clientBootstrap.connect(address).syncUninterruptibly();

      Channel channel = connectFuture.channel();
      ProtocolImpl protocol = ProtocolImpl.newInstance(sharedRef, channel, context);

      if (sslMode != SSLMode.Disable && sslMode != SSLMode.Allow) {

        // Execute SSL request command
View Full Code Here

            // Start the server.
            ChannelFuture f = b.bind(port).sync();

            // Wait until the server socket is closed.
            f.channel().closeFuture().sync();
        } finally {
            // Shut down all event loops to terminate all threads.
            b.shutdown();
        }
    }
View Full Code Here

            // Make the connection attempt.
            ChannelFuture f = b.connect(host, port).sync();

            // Wait until the connection is closed.
            f.channel().closeFuture().sync();
        } finally {
            b.shutdown();
        }
    }
View Full Code Here

            ChannelFuture f = b.bind(port).sync();

            // Wait until the server socket is closed.
            // In this example, this does not happen, but you can do that to gracefully
            // shut down your server.
            f.channel().closeFuture().sync();
        } finally {
            b.shutdown();
        }
    }
View Full Code Here

        b.group(inboundChannel.eventLoop())
         .channel(NioSocketChannel.class)
         .handler(new HexDumpProxyBackendHandler(inboundChannel))
         .option(ChannelOption.AUTO_READ, false);
        ChannelFuture f = b.connect(remoteHost, remotePort);
        outboundChannel = f.channel();
        f.addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                if (future.isSuccess()) {
                    // connection complete start to read first data
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.