Package io.netty.bootstrap

Examples of io.netty.bootstrap.ServerBootstrap.bind()


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

        // Bind and start to accept incoming connections.
        bootstrap.bind(new InetSocketAddress(port));
    }

    public static void main(String[] args) {
        int port;
        if (args.length > 0) {
View Full Code Here


         });
       }
     });

    // Bind and start to accept incoming connections.
    ChannelFuture channelFuture = b.bind().awaitUninterruptibly();

    for(int i = 0; i < threads; i++) {
      new SyslogMessageWriter(3000).start();
    }
View Full Code Here

        InetSocketAddress addr = new InetSocketAddress(configCopy.getPort());
        if (configCopy.getHostname() != null) {
            addr = new InetSocketAddress(configCopy.getHostname(), configCopy.getPort());
        }

        b.bind(addr).syncUninterruptibly();
        log.info("Session store / pubsub factory used: {}", configCopy.getStoreFactory());
        log.info("SocketIO server started at port: {}", configCopy.getPort());
    }

    protected void initGroups() {
View Full Code Here

        bootstrap.group(group)
                .channel(NioServerSocketChannel.class)
                .childHandler(pipelineFactory);

        try {
            future = bootstrap.bind(port).sync();
            SocketAddress socketAddress = future.channel().localAddress();
            address = (InetSocketAddress) socketAddress;
            return address.getPort();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
View Full Code Here

            }
        });

        addHandlers(this, listenContext);
        try {
          bindFuture = bootstrap.bind(new InetSocketAddress(InetAddress.getByName(options.getHost()), options.getPort()));
          Channel serverChannel = bindFuture.channel();
          serverChannelGroup.add(serverChannel);
          bindFuture.addListener(channelFuture -> {
              if (!channelFuture.isSuccess()) {
                vertx.sharedHttpServers().remove(id);
View Full Code Here

          handlerManager.addHandler(connectStream.handler(), listenContext);
        }

        try {
          InetSocketAddress addr = new InetSocketAddress(InetAddress.getByName(options.getHost()), options.getPort());
          bindFuture = bootstrap.bind(addr).addListener(future -> runListeners());
          this.addListener(() -> {
            if (bindFuture.isSuccess()) {
              log.trace("Net server listening on " + options.getHost() + ":" + bindFuture.channel().localAddress());
              // Update port to actual port - wildcard port 0 might have been used
              NetServerImpl.this.actualPort = ((InetSocketAddress)bindFuture.channel().localAddress()).getPort();
View Full Code Here

                        public void initChannel(SocketChannel ch) throws Exception {
                            ch.pipeline().addLast(NetworkErrorProxy.this.fh);
                        }
                    });

            f = b.bind(this.inboundPort).sync();
        } catch (Exception e) {
            log.warn("exception occurred", e);
        }
    }
View Full Code Here

        InetSocketAddress addr = new InetSocketAddress(configCopy.getPort());
        if (configCopy.getHostname() != null) {
            addr = new InetSocketAddress(configCopy.getHostname(), configCopy.getPort());
        }

        b.bind(addr).syncUninterruptibly();
        log.info("Session store / pubsub factory used: {}", configCopy.getStoreFactory());
        log.info("SocketIO server started at port: {}", configCopy.getPort());
    }

    protected void initGroups() {
View Full Code Here

        try {
            final ServerBootstrap sb = new ServerBootstrap();
            sb.group(bossGroup, workerGroup)
                    .channel(NioServerSocketChannel.class)
                    .childHandler(new SockJSChannelInitializer(simplePushConfig, config.dataStore(), config.sockJsConfig(), reaperExcutorGroup));
            final Channel ch = sb.bind(simplePushConfig.host(), simplePushConfig.port()).sync().channel();
            logger.info("Server started");
            logger.debug(config.toString());
            ch.closeFuture().sync();
        } finally {
            bossGroup.shutdownGracefully();
View Full Code Here

                .password("test")
                .build();
        sb.group(bossGroup, workerGroup)
                .channel(NioServerSocketChannel.class)
                .childHandler(new SockJSChannelInitializer(simplePushConfig, datastore, sockJSConfig, eventExecutorGroup));
        channel = sb.bind(port).sync().channel();
    }

    @AfterClass
    public static void stopSimplePushServer() throws InterruptedException {
        final ChannelFuture disconnect = channel.disconnect();
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.