docker-java has a nice wiki on https://github.com/docker-java/docker-java/wiki. Searching for "port" got me this:
Create new Docker container and start it with exposed ports
ExposedPort tcp22 = ExposedPort.tcp(22);
ExposedPort tcp23 = ExposedPort.tcp(23);
Ports portBindings = new Ports();
portBindings.bind(tcp22, Ports.Binding(11022));
portBindings.bind(tcp23, Ports.Binding(11023));
CreateContainerResponse container = dockerClient.createContainerCmd("busybox")
.withCmd("true")
.withExposedPorts(tcp22, tcp23)
.withPortBindings(portBindings)
.exec();
I looked at some tests in docker-java, and it looks like you only did half the work for running a container, because you only created the container and didn't start it. Based on what I see in this test (https://github.com/docker-java/docker-java/blob/069987852c842e3bba85ed3325a8877c36f9e87f/src/test/java/com/github/dockerjava/core/command/ExecStartCmdImplTest.java#L69), your code should look something like this:
ExposedPort tcp4444 = ExposedPort.tcp(4444);
Ports portBindings = new Ports();
portBindings.bind(tcp4444, Ports.Binding(4444));
// Create the container (it will not be running)
CreateContainerResponse container = dockerClient.createContainerCmd("selenium/hub")
.withName(name)
.withExposedPorts(tcp4444)
.withPortBindings(portBindings)
.exec();
// Actually run the container
dockerClient.startContainerCmd(container).exec();
As far as I can tell, there's no reason to explicitly run it in detached mode because it will be started asynchronously by default.