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();
}
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);
}
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);
}
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 };
}
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);
}
Aggregations