There is no direct way of doing this. But here's a hack of how this can be done.
- In your test project, create a new package
org.openqa.grid.selenium.proxy
- Now copy the class DefaultRemoteProxy into this package that you created (This would cause Java to now start utilising your version of
DefaultRemoteProxy
instead of what is available in the Selenium codebase)
- Now within the copied version of
DefaultRemoteProxy
alter its constructor to as shown below.
- Use one of the below mechanism to create an artifact which would be used to start your Hub.
- Create an uber jar out of your test project so that it can be used as your Selenium standalone jar (or)
- Create a jar out of your project, drop it in the CLASSPATH of Selenium standalone jar and then use
java -cp
(Feel free to choose whichever option works for you)
- Use the artifact created above, start off the hub.
After this, you should be able to prevent people from registering their nodes to your hub wherein the protocol is Selenium RC.
public DefaultRemoteProxy(RegistrationRequest request, Registry registry) {
super(request, registry);
for (TestSlot slot : getTestSlots()) {
if (slot.getProtocol() == SeleniumProtocol.Selenium) {
throw new IllegalStateException("Selenium RC Protocol is NOT supported.");
}
}
pollingInterval = config.nodePolling != null ? config.nodePolling : DEFAULT_POLLING_INTERVAL;
unregisterDelay = config.unregisterIfStillDownAfter != null ? config.unregisterIfStillDownAfter : DEFAULT_UNREGISTER_DELAY;
downPollingLimit = config.downPollingLimit != null ? config.downPollingLimit : DEFAULT_DOWN_POLLING_LIMIT;
}
This should help you achieve what you are after.
The flip side of this is that you would need to make sure you are constantly monitoring the contents of org.openqa.grid.selenium.proxy.DefaultRemoteProxy in the Selenium codebase and keep updating your local version else you may run into a situation wherein things go out of sync.