@SuppressWarnings("unchecked")
public THIS overrideHttpPort(int p) {
AbstractServerFactory sf = serverFactory();
if (sf instanceof SimpleServerFactory) {
SimpleServerFactory ssf = (SimpleServerFactory) sf;
((HttpConnectorFactory)ssf.getConnector()).setPort(p);
} else if (sf instanceof DefaultServerFactory) {
DefaultServerFactory dsf = (DefaultServerFactory) sf;
((HttpConnectorFactory)dsf.getApplicationConnectors().get(0)).setPort(p);
} else {
throw new IllegalStateException("Unrecognized ServerFactory: "+sf.getClass().getName());