[WAGON-579] Handle SC_UNAUTHORIZED and SC_PROXY_AUTHENTICATION_REQUIRED in all methods
diff --git a/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java b/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
index a90f8f4..4680416 100644
--- a/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
+++ b/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
@@ -1810,7 +1810,7 @@
             runTestSecuredPut( null );
             fail();
         }
-        catch ( TransferFailedException e )
+        catch ( AuthorizationException e )
         {
             assertTrue( true );
         }
@@ -1827,7 +1827,7 @@
             runTestSecuredPut( authInfo );
             fail();
         }
-        catch ( TransferFailedException e )
+        catch ( AuthorizationException e )
         {
             assertTrue( true );
         }
diff --git a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java b/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
index d0f32eb..82981c9 100644
--- a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
+++ b/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
@@ -170,7 +170,8 @@
                 String reasonPhrase = urlConnection.getResponseMessage();
 
                 if ( responseCode == HttpURLConnection.HTTP_FORBIDDEN
-                        || responseCode == HttpURLConnection.HTTP_UNAUTHORIZED )
+                        || responseCode == HttpURLConnection.HTTP_UNAUTHORIZED
+                        || responseCode == HttpURLConnection.HTTP_PROXY_AUTH )
                 {
                     throw new AuthorizationException( formatAuthorizationMessage( buildUrl( resource ),
                             responseCode, reasonPhrase, getProxyInfo() ) );
@@ -276,8 +277,9 @@
                 case HttpURLConnection.HTTP_NO_CONTENT: // 204
                     break;
 
-                // TODO: handle 401 explicitly?
                 case HttpURLConnection.HTTP_FORBIDDEN:
+                case HttpURLConnection.HTTP_UNAUTHORIZED:
+                case HttpURLConnection.HTTP_PROXY_AUTH:
                     throw new AuthorizationException( formatAuthorizationMessage( buildUrl( resource ), statusCode,
                             reasonPhrase, getProxyInfo() ) );
 
@@ -453,6 +455,7 @@
                     return false;
 
                 case HttpURLConnection.HTTP_UNAUTHORIZED:
+                case HttpURLConnection.HTTP_PROXY_AUTH:
                     throw new AuthorizationException( "Access denied to: " + url );
 
                 default:
diff --git a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
index 4927525..81d56d5 100755
--- a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
+++ b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
@@ -793,8 +793,10 @@
                     case HttpStatus.SC_ACCEPTED: // 202
                     case HttpStatus.SC_NO_CONTENT:  // 204
                         break;
-                    //case HttpStatus.SC_UNAUTHORIZED:
+
                     case HttpStatus.SC_FORBIDDEN:
+                    case HttpStatus.SC_UNAUTHORIZED:
+                    case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED:
                         EntityUtils.consumeQuietly( response.getEntity() );
                         fireSessionConnectionRefused();
                         throw new AuthorizationException( formatAuthorizationMessage( url,