code: public final void setServerNames(List<SNIServerName> serverNames) {
          if (serverNames != null) {
              if (!serverNames.isEmpty()) {
                  sniNames = new LinkedHashMap<>(serverNames.size());
                  for (SNIServerName serverName : serverNames) {
                      if (sniNames.put(serverName.getType(),
                                                  serverName) != null) {
                          throw new IllegalArgumentException(
                                      "Duplicated server name of type " +
                                      serverName.getType());
                      }
                  }
              } else {
                  sniNames = Collections.<Integer, SNIServerName>emptyMap();
              }
          } else {
              sniNames = null;
          }
      }
docs: Sets the desired {@link SNIServerName}s of the Server Name
  Indication (SNI) parameter.
  <P>
  This method is only useful to {@link SSLSocket}s or {@link SSLEngine}s
  operating in client mode.
  <P>
  Note that the {@code serverNames} list is cloned
  to protect against subsequent modification.
  
  @param  serverNames
  the list of desired {@link SNIServerName}s (or null)
  
  @throws NullPointerException if the {@code serverNames}
  contains {@code null} element
  @throws IllegalArgumentException if the {@code serverNames}
  contains more than one name of the same name type
  
  @see SNIServerName
  @see #getServerNames()
  
  @since 1.8