Reverting fa3a4ebcd81435a88a1dfe939b2bebece5785f15 which is specific to Wagon HTTP. The message prior to this change yielded:

[ERROR] Failed to execute goal on project test: Could not resolve dependencies for project org.apache.maven.its.mng3477:test:jar:1: Failed to collect dependencies at org.apache.maven.its.mng3477:dep:jar:1.0: Failed to read artifact descriptor for org.apache.maven.its.mng3477:dep:jar:1.0: Could not transfer artifact org.apache.maven.its.mng3477:dep:pom:1.0 from/to central (http://localhost:54312/repo): Connection refused -> [Help 1]

After the change:

[ERROR] Failed to execute goal on project test: Could not resolve dependencies for project org.apache.maven.its.mng3477:test:jar:1: Failed to collect dependencies at org.apache.maven.its.mng3477:dep:jar:1.0: Failed to read artifact descriptor for org.apache.maven.its.mng3477:dep:jar:1.0: Could not transfer artifact org.apache.maven.its.mng3477:dep:pom:1.0 from/to central (http://localhost:54312/repo): Connection to http://localhost:54312 refused: Connection refused -> [Help 1]

Notice the last part of the message. This type of message only comes from Wagon HTTP, but the original is sufficient to catch and report the error for HTTP Wagon and other Aether connectors. We want to detect and catch the connection refused exception and we do with the original regex.