you should be able to get them from task variables (task content) as by default all user task parameters go into task content.
The content approach seems to be cumbersome.
I am able to get it from workItem.
WorkItemManager witm = (WorkItemManager)session.getWorkItemManager();
WorkItem w = witm.getWorkItem(task.getTaskData().getWorkItemId());
String groupId = w.getParameter("GroupId").toString();