*/
@Override
public void connect(HttpConsumer consumer) throws Exception {
// Make sure that there is a connector for the requested endpoint.
HttpEndpoint endpoint = (HttpEndpoint)consumer.getEndpoint();
String connectorKey = endpoint.getProtocol() + ":" + endpoint.getPort();
synchronized (connectors) {
ConnectorRef connectorRef = connectors.get(connectorKey);
if (connectorRef == null) {
Connector connector;
if ("https".equals(endpoint.getProtocol())) {
connector = new SslSocketConnector();
} else {
connector = new SelectChannelConnector();
}
connector.setPort(endpoint.getPort());
getServer().addConnector(connector);
connector.start();
connectorRef = new ConnectorRef(connector);
connectors.put(connectorKey, connectorRef);
} else {