629 * Sets the prioritized array of application-layer protocol names that
630 * can be negotiated over the SSL/TLS/DTLS protocols.
631 * <p>
632 * If application-layer protocols are supported by the underlying
633 * SSL/TLS implementation, this method configures which values can
634 * be negotiated by protocols such as <a
635 * href="http://www.ietf.org/rfc/rfc7301.txt"> RFC 7301 </a>, the
636 * Application Layer Protocol Negotiation (ALPN).
637 * <p>
638 * If this end of the connection is expected to offer application protocol
639 * values, all protocols configured by this method will be sent to the
640 * peer.
641 * <p>
642 * If this end of the connection is expected to select the application
643 * protocol value, the {@code protocols} configured by this method are
644 * compared with those sent by the peer. The first matched value becomes
645 * the negotiated value. If none of the {@code protocols} were actually
646 * requested by the peer, the underlying protocol will determine what
647 * action to take. (For example, ALPN will send a
648 * {@code "no_application_protocol"} alert and terminate the connection.)
649 * <p>
650 * @implSpec
651 * This method will make a copy of the {@code protocols} array.
652 *
653 * @param protocols an ordered array of application protocols,
654 * with {@code protocols[0]} being the most preferred.
655 * If the array is empty (zero-length), protocol
656 * indications will not be used.
657 * @throws IllegalArgumentException if protocols is null, or if
658 * any element in a non-empty array is null or an
659 * empty (zero-length) string
660 * @see #getApplicationProtocols
661 * @since 9
662 */
663 public void setApplicationProtocols(String[] protocols) {
664 if (protocols == null) {
665 throw new IllegalArgumentException("protocols was null");
666 }
667
668 String[] tempProtocols = protocols.clone();
669
|
629 * Sets the prioritized array of application-layer protocol names that
630 * can be negotiated over the SSL/TLS/DTLS protocols.
631 * <p>
632 * If application-layer protocols are supported by the underlying
633 * SSL/TLS implementation, this method configures which values can
634 * be negotiated by protocols such as <a
635 * href="http://www.ietf.org/rfc/rfc7301.txt"> RFC 7301 </a>, the
636 * Application Layer Protocol Negotiation (ALPN).
637 * <p>
638 * If this end of the connection is expected to offer application protocol
639 * values, all protocols configured by this method will be sent to the
640 * peer.
641 * <p>
642 * If this end of the connection is expected to select the application
643 * protocol value, the {@code protocols} configured by this method are
644 * compared with those sent by the peer. The first matched value becomes
645 * the negotiated value. If none of the {@code protocols} were actually
646 * requested by the peer, the underlying protocol will determine what
647 * action to take. (For example, ALPN will send a
648 * {@code "no_application_protocol"} alert and terminate the connection.)
649 *
650 * @implSpec
651 * This method will make a copy of the {@code protocols} array.
652 *
653 * @param protocols an ordered array of application protocols,
654 * with {@code protocols[0]} being the most preferred.
655 * If the array is empty (zero-length), protocol
656 * indications will not be used.
657 * @throws IllegalArgumentException if protocols is null, or if
658 * any element in a non-empty array is null or an
659 * empty (zero-length) string
660 * @see #getApplicationProtocols
661 * @since 9
662 */
663 public void setApplicationProtocols(String[] protocols) {
664 if (protocols == null) {
665 throw new IllegalArgumentException("protocols was null");
666 }
667
668 String[] tempProtocols = protocols.clone();
669
|