Here is an example - the syntax is python (executed with jython), but should be trivial to write it in Java:
from org.gstreamer import *
from time import sleep
Gst.init()
p = Pipeline.launch("audiotestsrc freq=500 ! input-selector name=sel ! autoaudiosink audiotestsrc freq=400 ! sel. audiotestsrc freq=300 ! sel.")
sel = p.getElementByName("sel")
sel.set("active-pad", sel.getPad("sink0"))
p.play()
sleep(2)
p.stop()
sel.set("active-pad", sel.getPad("sink1"))
p.play()
sleep(2)
p.stop()
sel.set("active-pad", sel.getPad("sink2"))
p.play()
sleep(2)
p.stop()