adb shell settings get global captive_portal_detection_enabled
disable detection
adb shell settings put global captive_portal_detection_enabled 0
enable detection:
adb shell settings put global captive_portal_detection_enabled 1
Before Android 7.1
adb shell settings get global captive_portal_server
adb shell settings put global captive_portal_server "http.url"
After Android 7.1
adb shell settings get global captive_portal_http_url
adb shell settings put global captive_portal_http_url "http.url"