Package io.netty.channel

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


        return doBind(localAddress);
    }

    private ChannelFuture doBind(final SocketAddress localAddress) {
        final ChannelFuture regPromise = initAndRegister();
        final Channel channel = regPromise.channel();
        final ChannelPromise promise = channel.newPromise();
        if (regPromise.isDone()) {
            doBind0(regPromise, channel, localAddress, promise);
        } else {
            regPromise.addListener(new ChannelFutureListener() {
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

            // Start the client.
            ChannelFuture f = b.connect(host, port).sync();

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

            // Start the client.
            ChannelFuture f = b.connect(host, port).sync();

            // Wait until the connection is closed.
            f.channel().closeFuture().sync();
        } finally {
            // Shut down the event loop to terminate all threads.
            b.shutdown();
        }
    }
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

            // Start the client.
            ChannelFuture f = b.connect(host, port).sync();

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

                public void initChannel(SocketChannel ch) throws Exception {
                    ch.pipeline().addLast(new DiscardServerHandler());
                }
            });
            ChannelFuture f = bootstrap.bind(9999).sync();
            f.channel().closeFuture().sync();
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

          // Bind and start to accept incoming connections.
          ChannelFuture channelFuture = bootstrap.connect(
              serverAddress.getAddress(), serverAddress.getPort()).sync();
          // Get io channel
          channel = channelFuture.channel();
          LOG.info("AsyncClient startup");
          break;
        } catch (Exception ie) {
          /*
           * Check for an address change and update the local reference. Reset
View Full Code Here

        // Bind and start to accept incoming connections.
        ChannelFuture f = b.bind(port).sync();
        LOG.info("AsyncServer startup");
        // Wait until the server socket is closed.
        f.channel().closeFuture().sync();
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        // Shut down Server gracefully
        bossGroup.shutdownGracefully();
View Full Code Here

        b.channel(NioSocketChannel.class);
        b.handler(new MixClientInitializer(msgHandler, sslCtx));

        SocketAddress remoteAddr = server.getSocketAddress();
        ChannelFuture channelFuture = b.connect(remoteAddr).sync();
        Channel channel = channelFuture.channel();

        channelMap.put(server, channel);
    }

    @Override
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.