Search in sources :

Example 96 with NioEventLoopGroup

use of io.netty.channel.nio.NioEventLoopGroup in project hbase by apache.

the class TestAsyncWALReplay method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    GROUP = new NioEventLoopGroup(1, Threads.newDaemonThreadFactory("TestAsyncWALReplay"));
    Configuration conf = AbstractTestWALReplay.TEST_UTIL.getConfiguration();
    conf.set(WALFactory.WAL_PROVIDER, "asyncfs");
    AbstractTestWALReplay.setUpBeforeClass();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) BeforeClass(org.junit.BeforeClass)

Example 97 with NioEventLoopGroup

use of io.netty.channel.nio.NioEventLoopGroup in project flink by apache.

the class NettyClient method initNioBootstrap.

private void initNioBootstrap() {
    // Add the server port number to the name in order to distinguish
    // multiple clients running on the same host.
    String name = NettyConfig.CLIENT_THREAD_GROUP_NAME + " (" + config.getServerPort() + ")";
    NioEventLoopGroup nioGroup = new NioEventLoopGroup(config.getClientNumThreads(), NettyServer.getNamedThreadFactory(name));
    bootstrap.group(nioGroup).channel(NioSocketChannel.class);
}
Also used : NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup)

Example 98 with NioEventLoopGroup

use of io.netty.channel.nio.NioEventLoopGroup in project flink by apache.

the class NettyServer method initNioBootstrap.

private void initNioBootstrap() {
    // Add the server port number to the name in order to distinguish
    // multiple servers running on the same host.
    String name = NettyConfig.SERVER_THREAD_GROUP_NAME + " (" + config.getServerPort() + ")";
    NioEventLoopGroup nioGroup = new NioEventLoopGroup(config.getServerNumThreads(), getNamedThreadFactory(name));
    bootstrap.group(nioGroup).channel(NioServerSocketChannel.class);
}
Also used : NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup)

Example 99 with NioEventLoopGroup

use of io.netty.channel.nio.NioEventLoopGroup in project hive by apache.

the class TestRpc method createRpcConnection.

private Rpc[] createRpcConnection(RpcServer server, Map<String, String> clientConf) throws Exception {
    String secret = server.createSecret();
    Future<Rpc> serverRpcFuture = server.registerClient("client", secret, new TestDispatcher());
    NioEventLoopGroup eloop = new NioEventLoopGroup();
    Future<Rpc> clientRpcFuture = Rpc.createClient(clientConf, eloop, "localhost", server.getPort(), "client", secret, new TestDispatcher());
    Rpc serverRpc = autoClose(serverRpcFuture.get(10, TimeUnit.SECONDS));
    Rpc clientRpc = autoClose(clientRpcFuture.get(10, TimeUnit.SECONDS));
    return new Rpc[] { serverRpc, clientRpc };
}
Also used : NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup)

Example 100 with NioEventLoopGroup

use of io.netty.channel.nio.NioEventLoopGroup in project hive by apache.

the class TestRpc method testBadHello.

@Test
public void testBadHello() throws Exception {
    RpcServer server = autoClose(new RpcServer(emptyConfig));
    Future<Rpc> serverRpcFuture = server.registerClient("client", "newClient", new TestDispatcher());
    NioEventLoopGroup eloop = new NioEventLoopGroup();
    Future<Rpc> clientRpcFuture = Rpc.createClient(emptyConfig, eloop, "localhost", server.getPort(), "client", "wrongClient", new TestDispatcher());
    try {
        autoClose(clientRpcFuture.get(10, TimeUnit.SECONDS));
        fail("Should have failed to create client with wrong secret.");
    } catch (ExecutionException ee) {
        // On failure, the SASL handler will throw an exception indicating that the SASL
        // negotiation failed.
        assertTrue("Unexpected exception: " + ee.getCause(), ee.getCause() instanceof SaslException);
    }
    serverRpcFuture.cancel(true);
}
Also used : ExecutionException(java.util.concurrent.ExecutionException) SaslException(javax.security.sasl.SaslException) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) Test(org.junit.Test)

Aggregations

NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)181 EventLoopGroup (io.netty.channel.EventLoopGroup)89 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)71 Bootstrap (io.netty.bootstrap.Bootstrap)65 Channel (io.netty.channel.Channel)51 ChannelFuture (io.netty.channel.ChannelFuture)50 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)48 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)46 SocketChannel (io.netty.channel.socket.SocketChannel)39 SslContext (io.netty.handler.ssl.SslContext)37 InetSocketAddress (java.net.InetSocketAddress)35 LoggingHandler (io.netty.handler.logging.LoggingHandler)33 ChannelPipeline (io.netty.channel.ChannelPipeline)30 SelfSignedCertificate (io.netty.handler.ssl.util.SelfSignedCertificate)26 Test (org.testng.annotations.Test)23 ByteBuf (io.netty.buffer.ByteBuf)18 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)18 NettyClientMetrics (com.linkedin.pinot.transport.metrics.NettyClientMetrics)16 HashedWheelTimer (io.netty.util.HashedWheelTimer)16 ChannelInitializer (io.netty.channel.ChannelInitializer)15