diff src/ch/ethz/ssh2/transport/HTTPProxyClientTransportManager.java @ 307:071eccdff8ea ganymed

fix java formatting
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 14:16:58 -0700
parents 91a31873c42a
children
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/transport/HTTPProxyClientTransportManager.java	Wed Jul 30 12:09:51 2014 -0700
+++ b/src/ch/ethz/ssh2/transport/HTTPProxyClientTransportManager.java	Wed Jul 30 14:16:58 2014 -0700
@@ -34,19 +34,16 @@
 
     @Override
     protected void connect(final String hostname, final int port, final int connectTimeout) throws IOException {
-
         sock.connect(new InetSocketAddress(pd.proxyHost, pd.proxyPort), connectTimeout);
-
         // Tell the proxy where we actually want to connect to
         StringBuilder sb = new StringBuilder();
-
         sb.append("CONNECT ");
         sb.append(hostname);
         sb.append(':');
         sb.append(port);
         sb.append(" HTTP/1.0\r\n");
 
-        if((pd.proxyUser != null) && (pd.proxyPass != null)) {
+        if ((pd.proxyUser != null) && (pd.proxyPass != null)) {
             String credentials = pd.proxyUser + ":" + pd.proxyPass;
             char[] encoded = Base64.encode(StringEncoder.GetBytes(credentials));
             sb.append("Proxy-Authorization: Basic ");
@@ -54,9 +51,9 @@
             sb.append("\r\n");
         }
 
-        if(pd.requestHeaderLines != null) {
-            for(int i = 0; i < pd.requestHeaderLines.length; i++) {
-                if(pd.requestHeaderLines[i] != null) {
+        if (pd.requestHeaderLines != null) {
+            for (int i = 0; i < pd.requestHeaderLines.length; i++) {
+                if (pd.requestHeaderLines[i] != null) {
                     sb.append(pd.requestHeaderLines[i]);
                     sb.append("\r\n");
                 }
@@ -64,26 +61,21 @@
         }
 
         sb.append("\r\n");
-
         OutputStream out = sock.getOutputStream();
-
         out.write(StringEncoder.GetBytes(sb.toString()));
         out.flush();
-
         // Parse the HTTP response
-
         InputStream in = sock.getInputStream();
-
         final LineNumberReader reader = new LineNumberReader(new InputStreamReader(in));
         String httpReponse = reader.readLine();
 
-        if(!httpReponse.startsWith("HTTP/")) {
+        if (!httpReponse.startsWith("HTTP/")) {
             throw new IOException("The proxy did not send back a valid HTTP response.");
         }
 
         // "HTTP/1.X XYZ X" => 14 characters minimum
 
-        if((httpReponse.length() < 14) || (httpReponse.charAt(8) != ' ') || (httpReponse.charAt(12) != ' ')) {
+        if ((httpReponse.length() < 14) || (httpReponse.charAt(8) != ' ') || (httpReponse.charAt(12) != ' ')) {
             throw new IOException("The proxy did not send back a valid HTTP response.");
         }
 
@@ -92,19 +84,19 @@
         try {
             errorCode = Integer.parseInt(httpReponse.substring(9, 12));
         }
-        catch(NumberFormatException ignore) {
+        catch (NumberFormatException ignore) {
             throw new IOException("The proxy did not send back a valid HTTP response.");
         }
 
-        if((errorCode < 0) || (errorCode > 999)) {
+        if ((errorCode < 0) || (errorCode > 999)) {
             throw new IOException("The proxy did not send back a valid HTTP response.");
         }
 
-        if(errorCode != 200) {
+        if (errorCode != 200) {
             throw new HTTPProxyException(httpReponse.substring(13), errorCode);
         }
 
-        while(reader.readLine() != null) {
+        while (reader.readLine() != null) {
             // Read until empty line
         }
     }