Path: blob/master/test/jdk/javax/net/ssl/HttpsURLConnection/DefaultCacheResponse.java
41152 views
/*1* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 821226126* @summary Add SSLSession accessors to HttpsURLConnection and27* SecureCacheResponse28*/2930import java.io.IOException;31import java.io.InputStream;32import java.net.SecureCacheResponse;33import java.security.Principal;34import java.security.cert.Certificate;35import java.util.List;36import java.util.Map;37import java.util.Optional;38import javax.net.ssl.SSLPeerUnverifiedException;39import javax.net.ssl.SSLSession;4041public class DefaultCacheResponse extends SecureCacheResponse {4243public static void main(String[] args) throws Exception {44DefaultCacheResponse defaultImpl = new DefaultCacheResponse();4546Optional<SSLSession> sslSession = defaultImpl.getSSLSession();47if (sslSession.isPresent()) {48throw new Exception(49"The default SecureCacheResponse.getSSLSession " +50"implementation should return an empty Optional");51}52}5354@Override55public String getCipherSuite() {56throw new UnsupportedOperationException("Not supported yet.");57}5859@Override60public List<Certificate> getLocalCertificateChain() {61throw new UnsupportedOperationException("Not supported yet.");62}6364@Override65public List<Certificate> getServerCertificateChain()66throws SSLPeerUnverifiedException {67throw new UnsupportedOperationException("Not supported yet.");68}6970@Override71public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {72throw new UnsupportedOperationException("Not supported yet.");73}7475@Override76public Principal getLocalPrincipal() {77throw new UnsupportedOperationException("Not supported yet.");78}7980@Override81public Map<String, List<String>> getHeaders() throws IOException {82throw new UnsupportedOperationException("Not supported yet.");83}8485@Override86public InputStream getBody() throws IOException {87throw new UnsupportedOperationException("Not supported yet.");88}89}909192