'how to add 'host_name' extension for SNI in java (using jetty)

i am trying in every way to add the SNI to my client (jetty 11.0.9). The server requires me to send host_name, but there is no way with jetty. can anyone do it?



Solution 1:[1]

Jetty's HttpClient uses the Java SSLEngine to initiate TLS connections and will use SNI by default.

Just use one of the HttpClient.newRequest() methods to create a Request with either an absolute URI (that includes the authority, hostname, port) or the newRequest() methods that take a hostname / port pair.

Note that the Java SSLEngine will follow the TLS/SNI spec and will not send SNI if the destination host is localhost or an IP Address (you must use a hostname, always, with SNI)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1