List addresses = manager.getLocalAddresses();
List responseAddresses = new ArrayList(addresses.size());
Iterator iter = addresses.iterator();
TransportAddress addr;
while (iter.hasNext()) {
addr = (TransportAddress)iter.next();
if (proto != null) {
if (proto.equals(addr.getProto())) {
responseAddresses.add(addr);
break;
}
} else {
responseAddresses.add(addr);
}
}
if (responseAddresses.size() < 1) {
response = errorResponse(MainDetectionManager.PROTO_RESP_NOTFOUND, "Cannot manage protocol "+proto);
} else {
response = MainDetectionManager.PROTO_RESP_OK;
iter = responseAddresses.iterator();
while (iter.hasNext()) {
addr = (TransportAddress)iter.next();
// FIXME use toString()
//response += addr.toString();
response += addr.getProto()+MainDetectionManager.PROTO_ADDR_SEPARATOR+addr.getHost()+MainDetectionManager.PROTO_ADDR_SEPARATOR+addr.getPort();
if (iter.hasNext()) {
response += MainDetectionManager.PROTO_ADDRESSES_SEPARATOR;
}
}
}