adb: use asocket's close function when closing.

close_all_sockets was assuming that all registered local sockets used
local_socket_close as their close function. However, this is not true
for JDWP sockets.

Bug: http://b/28347842
Change-Id: I40a1174845cd33f15f30ce70828a7081cd5a087e
(cherry picked from commit 53eb31d87cb84a4212f4850bf745646e1fb12814)

char* skip_host_serial(const char* service) {
 static const std::vector<std::string>& prefixes =
 *(new std::vector<std::string>{"usb:", "product:", "model:", "device:"});

 for (const std::string& prefix : prefixes) {
 if (!strncmp(service, prefix.c_str(), prefix.length())) {
 return strchr(service + prefix.length(), ':');
 }
 }

 if (!strncmp(service, "tcp:", 4) || !strncmp(service, "udp:", 4)) {
        service += 4;
 }

 char* first_colon = strchr(service, ':');
 if (!first_colon) {
 return nullptr;
 }

 char* serial_end = first_colon;
 if (isdigit(serial_end[1])) {
        serial_end++;
 while (*serial_end && isdigit(*serial_end)) {
            serial_end++;
 }
 if (*serial_end != ':') {
            serial_end = first_colon;
 }
 }
 return serial_end;
}

char* skip_host_serial(const char* service) {
 static const std::vector<std::string>& prefixes =
 *(new std::vector<std::string>{"usb:", "product:", "model:", "device:"});

 for (const std::string& prefix : prefixes) {
 if (!strncmp(service, prefix.c_str(), prefix.length())) {
 return strchr(service + prefix.length(), ':');
 }
 }

 if (!strncmp(service, "tcp:", 4) || !strncmp(service, "udp:", 4)) {
        service += 4;
 }

 char* first_colon = strchr(service, ':');
 if (!first_colon) {
 return nullptr;
 }

 char* serial_end = first_colon;
 if (isdigit(serial_end[1])) {
        serial_end++;
 while (*serial_end && isdigit(*serial_end)) {
            serial_end++;
 }
 if (*serial_end != ':') {
            serial_end = first_colon;
 }
 }
 return serial_end;
}
