when(context.getConfiguration()).thenReturn(conf);
ServerData<IntWritable, IntWritable, IntWritable> serverData =
MockUtils.createNewServerData(conf, context);
WorkerInfo workerInfo = new WorkerInfo();
NettyServer server = new NettyServer(conf,
new WorkerRequestServerHandler.Factory(serverData), workerInfo,
context, new MockExceptionHandler());
server.start();
workerInfo.setInetSocketAddress(server.getMyAddress());
List<WorkerInfo> addresses = Lists.<WorkerInfo>newArrayList(workerInfo);
NettyClient client1 = new NettyClient(context, conf, new WorkerInfo(),
new MockExceptionHandler());
client1.connectAllAddresses(addresses);
NettyClient client2 = new NettyClient(context, conf, new WorkerInfo(),
new MockExceptionHandler());
client2.connectAllAddresses(addresses);
NettyClient client3 = new NettyClient(context, conf, new WorkerInfo(),
new MockExceptionHandler());
client3.connectAllAddresses(addresses);
client1.stop();
client2.stop();
client3.stop();
server.stop();
}