public class FileServerHandler extends SimpleChannelInboundHandler<String> {
@Override
public void messageReceived(ChannelHandlerContext ctx, String fileName) throws Exception {
RandomAccessFile file = new RandomAccessFile(fileName, "r");
ctx.write(new DefaultFileRegion(file.getChannel(), 0, file.length()));
}
}