ServerData<IntWritable, IntWritable, IntWritable, IntWritable> serverData =
MockUtils.createNewServerData(conf, context);
RequestServerHandler.Factory requestServerHandlerFactory =
new WorkerRequestServerHandler.Factory(serverData);
WorkerInfo workerInfo1 = new WorkerInfo();
workerInfo1.setTaskId(1);
NettyServer server1 =
new NettyServer(conf, requestServerHandlerFactory, workerInfo1, context);
server1.start();
workerInfo1.setInetSocketAddress(server1.getMyAddress());
WorkerInfo workerInfo2 = new WorkerInfo();
workerInfo1.setTaskId(2);
NettyServer server2 =
new NettyServer(conf, requestServerHandlerFactory, workerInfo2,
context);
server2.start();
workerInfo2.setInetSocketAddress(server2.getMyAddress());
WorkerInfo workerInfo3 = new WorkerInfo();
workerInfo1.setTaskId(3);
NettyServer server3 =
new NettyServer(conf, requestServerHandlerFactory, workerInfo3,
context);
server3.start();
workerInfo3.setInetSocketAddress(server3.getMyAddress());
NettyClient client = new NettyClient(context, conf, new WorkerInfo());
List<WorkerInfo> addresses = Lists.<WorkerInfo>newArrayList(workerInfo1,
workerInfo2, workerInfo3);
client.connectAllAddresses(addresses);
client.stop();