1: …… 2: String getPassword() { 3: return "secret_password"; 4: } 5: 6: void foo() { 7: try { 8: Socket socket = new Socket("taranis", 4444); 9: PrintStream out = new PrintStream(socket.getOutputStream(), true); 10: Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding" ); 11: String password = getPassword(); 12: byte[] encryptedStr = c.update(password.getBytes()); 13: out.write(encryptedStr, 0, encryptedStr.length); 14: } catch (FileNotFoundException e) { 15: …… 16: }