I reply to myself.
Simply set encapsulated to true when creating the IpParameters.
IpParameters ip = new IpParameters();
ip.setHost("192.168.15.30");
ip.setEncapsulated(true);
ip.setPort(4001);
ModbusFactory factory = new ModbusFactory();
ModbusMaster master = factory.createTcpMaster(ip, true);