fixed protocol version < 3.7 secType bug

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4667 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tigervnc/rfb/CConnection.java b/java/src/com/tigervnc/rfb/CConnection.java
index da4ac6f..15e1989 100644
--- a/java/src/com/tigervnc/rfb/CConnection.java
+++ b/java/src/com/tigervnc/rfb/CConnection.java
@@ -100,6 +100,7 @@
     vlog.info("processing security types message");
 
     int secType = Security.secTypeInvalid;
+
     List<Integer> secTypes = new ArrayList<Integer>();
     secTypes = security.GetEnabledSecTypes();
     //for (Iterator i = secTypes.iterator(); i.hasNext(); )
@@ -121,10 +122,10 @@
             secType = refType;
             break;
           }
+          if (!i.hasNext())
+            secType = Security.secTypeInvalid;
         }
       
-        if (!i.hasNext())
-          secType = Security.secTypeInvalid;
       } else {
         vlog.error("Unknown 3.3 security type "+secType);
         throw new Exception("Unknown 3.3 security type");