code: private boolean doUserPasswordAuthentication(Socket s,
                                                  InputStream in,
                                                  OutputStream out) 
                                                  throws IOException{
       int version = in.read();
       if(version != 1) return false;
       int ulen = in.read();
       if(ulen < 0) return false;
       byte[] user = new byte[ulen];
       in.read(user);
       int plen = in.read();
       if(plen < 0) return false;
       byte[] password = new byte[plen];
       in.read(password);
  
       if(validator.isUserValid(new String(user), new String(password),s)){
         //System.out.println("user valid");
         out.write(new byte[]{1,0});
       }else{
         //System.out.println("user invalid");
         out.write(new byte[]{1,1});
         return false;
       }
  
       return true;
     }
docs: ////////////////