test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java
branchhttp-client-branch
changeset 56265 ec34ae013fbe
parent 56261 a339fe1aab55
child 56451 9585061fdb04
equal deleted inserted replaced
56264:c012b93297b0 56265:ec34ae013fbe
   213 
   213 
   214     private static void handshake(String name, SSLSocket sock) throws IOException {
   214     private static void handshake(String name, SSLSocket sock) throws IOException {
   215         if (name == null) {
   215         if (name == null) {
   216             // no name set. No need to check
   216             // no name set. No need to check
   217             return;
   217             return;
   218         } else if (name.equals("127.0.0.1")) {
   218         } else if (name.equals("localhost")) {
   219             name = "localhost";
   219             name = "localhost";
   220         }
   220         }
   221         final String fname = name;
   221         final String fname = name;
   222         final InetAddress addr1 = InetAddress.getByName(name);
   222         final InetAddress addr1 = InetAddress.getByName(name);
   223         SSLParameters params = sock.getSSLParameters();
   223         SSLParameters params = sock.getSSLParameters();
   224         SNIMatcher matcher = new SNIMatcher(StandardConstants.SNI_HOST_NAME) {
   224         SNIMatcher matcher = new SNIMatcher(StandardConstants.SNI_HOST_NAME) {
   225             public boolean matches (SNIServerName n) {
   225             public boolean matches (SNIServerName n) {
   226                 String host = ((SNIHostName)n).getAsciiName();
   226                 String host = ((SNIHostName)n).getAsciiName();
   227                 if (host.equals("127.0.0.1"))
   227                 if (host.equals("localhost"))
   228                     host = "localhost";
   228                     host = "localhost";
   229                 boolean cmp = host.equalsIgnoreCase(fname);
   229                 boolean cmp = host.equalsIgnoreCase(fname);
   230                 if (cmp)
   230                 if (cmp)
   231                     return true;
   231                     return true;
   232                 return compareIPAddrs(addr1, host);
   232                 return compareIPAddrs(addr1, host);