@@ -653,19 +653,28 @@ public String[] getApplicationProtocols() {
653653 * {@code String} should be exchanged using {@code UTF-8}, the
654654 * {@code String} should be converted to its {@code byte[]} representation
655655 * and stored as a byte-oriented {@code String} before calling this method.
656+ * For example:
656657 *
657658 * <blockquote><pre>
658- * // MEETEI MAYEK LETTERS HUK UN I (Unicode 0xabcd->0xabcf): 2 bytes
659- * byte[] bytes = "\u005cuabcd\u005cuabce\u005cuabcf"
660- * .getBytes(StandardCharsets.UTF_8);
661- * String HUK_UN_I = new String(bytes, StandardCharsets.ISO_8859_1);
659+ * // Encode 3 Meetei Mayek letters (HUK, UN, I) using Unicode Escapes
660+ * // 0xabcd->0xabcf, 2 Unicode bytes/letter.
661+ * String HUK_UN_I = "\u005cuabcd\u005cuabce\u005cuabcf";
662662 *
663- * // 0x00-0xFF: 1 byte
664- * String rfc7301Grease8A = "\u005cu008A\u005cu008A" ;
663+ * // Convert into UTF-8 encoded bytes (3 bytes/letter)
664+ * byte[] bytes = HUK_UN_I.getBytes(StandardCharsets.UTF_8) ;
665665 *
666+ * // Preserve octet byte order by using ISO_8859_1 encoding
667+ * String encodedHukUnI =
668+ * new String(bytes, StandardCharsets.ISO_8859_1);
669+ *
670+ * // Also, encode a two byte RFC 8701 GREASE ALPN value
671+ * // e.g. 0x0A, 0x1A, 0x2A...0xFA
672+ * String rfc8701Grease8A = "\u005cu008A\u005cu008A";
673+ *
674+ * // Set the ALPN vlues on the sslSocket.
666675 * SSLParameters p = sslSocket.getSSLParameters();
667676 * p.setApplicationProtocols(new String[] {
668- * "h2", "http/1.1", rfc7301Grease8A, HUK_UN_I });
677+ * "h2", "http/1.1", encodedHukUnI, rfc8701Grease8A });
669678 * sslSocket.setSSLParameters(p);
670679 * </pre></blockquote>
671680 *
0 commit comments