create Host Name Verifier - Java Network

Java examples for Network:Http

Description

create Host Name Verifier

Demo Code

/*******************************************************************************
 * Copyright (c) 2012,2014 EclipseSource and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:// ww  w.  j  a  va  2s . c  om
 *    Holger Staudacher - initial API and implementation
 ******************************************************************************/
//package com.java2s;

import javax.net.ssl.HostnameVerifier;

import javax.net.ssl.SSLSession;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(createHostNameVerifier());
    }

    public static HostnameVerifier createHostNameVerifier() {
        HostnameVerifier verifier = new HostnameVerifier() {

            @Override
            public boolean verify(String hostname, SSLSession session) {
                return true;
            }
        };
        return verifier;
    }
}

Related Tutorials