}
}
private void checkWildcardHost(boolean succeed, Server server, String[] contextHosts, String[] requestHosts) throws Exception
{
LocalConnector connector = (LocalConnector)server.getConnectors()[0];
ContextHandlerCollection handlerCollection = (ContextHandlerCollection)server.getHandler();
ContextHandler context = (ContextHandler)handlerCollection.getHandlers()[0];
IsHandledHandler handler = (IsHandledHandler)context.getHandler();
context.setVirtualHosts(contextHosts);
// trigger this manually; it's supposed to be called when adding the handler
handlerCollection.mapContexts();
for(int i = 0; i < requestHosts.length; ++i)
{
String host = requestHosts[i];
connector.getResponses("GET / HTTP/1.1\n" + "Host: "+host+"\n\n");
if(succeed)
assertTrue("'"+host+"' should have been handled.",handler.isHandled());
else
assertFalse("'"+host + "' should not have been handled.", handler.isHandled());
handler.reset();