/** * Apply the connection option to the server. * * @param domainSocket whether it's a domain socket server * @param bootstrap the Netty server bootstrap */ private void applyConnectionOptions(boolean domainSocket, ServerBootstrap bootstrap) { vertx.transport().configure(options, domainSocket, bootstrap); }
private void applyConnectionOptions(boolean domainSocket, ServerBootstrap bootstrap) { vertx.transport().configure(options, domainSocket, bootstrap); }
private void applyConnectionOptions(boolean domainSocket, Bootstrap bootstrap) { vertx.transport().configure(options, domainSocket, bootstrap); }
private void applyConnectionOptions(boolean domainSocket, Bootstrap bootstrap) { client.getVertx().transport().configure(options, domainSocket, bootstrap); }
private void handleConnect(SocketAddress remoteAddress, SocketAddress peerAddress, String serverName, Handler<AsyncResult<Channel>> channelHandler) { VertxInternal vertx = context.owner(); bootstrap.resolver(vertx.nettyAddressResolverGroup()); bootstrap.handler(new ChannelInitializer<Channel>() { @Override protected void initChannel(Channel ch) { initSSL(peerAddress, serverName, ch, channelHandler); } }); ChannelFuture fut = bootstrap.connect(vertx.transport().convert(remoteAddress, false)); fut.addListener(res -> { if (res.isSuccess()) { connected(fut.channel(), channelHandler); } else { channelHandler.handle(io.vertx.core.Future.failedFuture(res.cause())); } }); }
public static AsyncResolveConnectHelper doBind(VertxInternal vertx, SocketAddress socketAddress, ServerBootstrap bootstrap) { AsyncResolveConnectHelper asyncResolveConnectHelper = new AsyncResolveConnectHelper(); bootstrap.channelFactory(vertx.transport().serverChannelFactory(socketAddress.path() != null)); if (socketAddress.path() != null) { java.net.SocketAddress converted = vertx.transport().convert(socketAddress, true); ChannelFuture future = bootstrap.bind(converted); future.addListener(f -> {
java.net.SocketAddress targetAddress = vertx.transport().convert(remoteAddress, false);
Transport transport = vertx.transport(); actualCtx = vertx.getOrCreateContext(); channel = transport.datagramChannel(this.dnsServer.getAddress() instanceof Inet4Address ? InternetProtocolFamily.IPv4 : InternetProtocolFamily.IPv6);
Bootstrap bootstrap = new Bootstrap(); bootstrap.group(context.nettyEventLoop()); bootstrap.channelFactory(vertx.transport().channelFactory(remoteAddress.path() != null));
bootstrap.channelFactory(client.getVertx().transport().channelFactory(false));
private DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) { Transport transport = vertx.transport(); DatagramChannel channel = transport.datagramChannel(options.isIpV6() ? InternetProtocolFamily.IPv6 : InternetProtocolFamily.IPv4); transport.configure(channel, new DatagramSocketOptions(options)); ContextInternal context = vertx.getOrCreateContext(); channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); MaxMessagesRecvByteBufAllocator bufAllocator = channel.config().getRecvByteBufAllocator(); bufAllocator.maxMessagesPerRead(1); context.nettyEventLoop().register(channel); if (options.getLogActivity()) { channel.pipeline().addLast("logging", new LoggingHandler()); } VertxMetrics metrics = vertx.metricsSPI(); this.metrics = metrics != null ? metrics.createDatagramSocketMetrics(options) : null; this.channel = channel; this.context = context; this.demand = Long.MAX_VALUE; }
ServerBootstrap bs = new ServerBootstrap(); bs.group(context.nettyEventLoop()); bs.channelFactory(((VertxInternal)vertx).transport().serverChannelFactory(false)) ; bs.option(ChannelOption.SO_BACKLOG, 100); bs.childHandler(new ChannelInitializer<SocketChannel>() {
CountDownLatch connectLatch = new CountDownLatch(1); Bootstrap bootstrap = new Bootstrap(); bootstrap.channelFactory(((VertxInternal)vertx).transport().channelFactory(false)); bootstrap.group(vertx.nettyEventLoopGroup()); bootstrap.resolver(((VertxInternal) vertx).nettyAddressResolverGroup());
/** * Apply the connection option to the server. * * @param domainSocket whether it's a domain socket server * @param bootstrap the Netty server bootstrap */ private void applyConnectionOptions(boolean domainSocket, ServerBootstrap bootstrap) { vertx.transport().configure(options, domainSocket, bootstrap); }
private void applyConnectionOptions(boolean domainSocket, ServerBootstrap bootstrap) { vertx.transport().configure(options, domainSocket, bootstrap); }
private void applyConnectionOptions(boolean domainSocket, Bootstrap bootstrap) { vertx.transport().configure(options, domainSocket, bootstrap); }
private void applyConnectionOptions(boolean domainSocket, Bootstrap bootstrap) { client.getVertx().transport().configure(options, domainSocket, bootstrap); }
private void handleConnect(SocketAddress remoteAddress, SocketAddress peerAddress, String serverName, Handler<AsyncResult<Channel>> channelHandler) { VertxInternal vertx = context.owner(); bootstrap.resolver(vertx.nettyAddressResolverGroup()); bootstrap.handler(new ChannelInitializer<Channel>() { @Override protected void initChannel(Channel ch) { initSSL(peerAddress, serverName, ch, channelHandler); } }); ChannelFuture fut = bootstrap.connect(vertx.transport().convert(remoteAddress, false)); fut.addListener(res -> { if (res.isSuccess()) { connected(fut.channel(), channelHandler); } else { channelHandler.handle(io.vertx.core.Future.failedFuture(res.cause())); } }); }
private DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) { Transport transport = vertx.transport(); DatagramChannel channel = transport.datagramChannel(options.isIpV6() ? InternetProtocolFamily.IPv6 : InternetProtocolFamily.IPv4); transport.configure(channel, new DatagramSocketOptions(options)); ContextInternal context = vertx.getOrCreateContext(); if (context.isMultiThreadedWorkerContext()) { throw new IllegalStateException("Cannot use DatagramSocket in a multi-threaded worker verticle"); } channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); MaxMessagesRecvByteBufAllocator bufAllocator = channel.config().getRecvByteBufAllocator(); bufAllocator.maxMessagesPerRead(1); context.nettyEventLoop().register(channel); if (options.getLogActivity()) { channel.pipeline().addLast("logging", new LoggingHandler()); } VertxMetrics metrics = vertx.metricsSPI(); this.metrics = metrics != null ? metrics.createDatagramSocketMetrics(options) : null; this.channel = channel; this.context = context; this.demand = Long.MAX_VALUE; }
CountDownLatch connectLatch = new CountDownLatch(1); Bootstrap bootstrap = new Bootstrap(); bootstrap.channelFactory(((VertxInternal)vertx).transport().channelFactory(false)); bootstrap.group(vertx.nettyEventLoopGroup()); bootstrap.resolver(((VertxInternal) vertx).nettyAddressResolverGroup());