I found myself needing to run Selenium tests from Java against a Selenium server running on a port other than the default 4444. Every example on the web showed me almost the right way to configure this from within JUnit... so now that I've got it working, I'm documenting it. :)
public void setUp() throws Exception {
// this is the normal way
// setUp(server_url, "*chrome");
// this is the alternate port way
selenium = new DefaultSelenium("localhost", 11111, "*firefox", server_url );
selenium.start();
}
Hopefully this will save a few others some time!
Free Bonus Tip
Here's how to start and stop the Selenium server from an Ant script.
<target name="start_server" description="Starts a Selenium Server in the background">
<java jar="${lib}/selenium-server.jar" fork="true" spawn="true"/>
</target>
<target name="stop_server" description="Stops your local Selenium Server">
<