1561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes/* Licensed to the Apache Software Foundation (ASF) under one or more 2561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * contributor license agreements. See the NOTICE file distributed with 3561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * this work for additional information regarding copyright ownership. 4561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * The ASF licenses this file to You under the Apache License, Version 2.0 5561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * (the "License"); you may not use this file except in compliance with 6561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * the License. You may obtain a copy of the License at 7561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * 8561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 9561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * 10561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * Unless required by applicable law or agreed to in writing, software 11561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 12561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * See the License for the specific language governing permissions and 14561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes * limitations under the License. 15561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes */ 16561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 17561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughespackage org.apache.harmony.luni.tests.java.net; 18561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 19561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.io.IOException; 20561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.io.InputStream; 21561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.net.SecureCacheResponse; 22561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.security.Principal; 23561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.security.cert.Certificate; 24561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.util.List; 25561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport java.util.Map; 26561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 27561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport javax.net.ssl.SSLPeerUnverifiedException; 28561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 29561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesimport junit.framework.TestCase; 30561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 31561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughespublic class SecureCacheResponseTest extends TestCase { 32561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 33561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public void testSecureCacheResponse() { 34561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // test constructor 35561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes SecureCacheResponse sc = new MockCacheResponse(); 36561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // nothing happened 37561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes assertNull(sc.getCipherSuite()); 38561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 39561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 40561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes class MockCacheResponse extends SecureCacheResponse{ 41561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 42561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes @Override 43561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public String getCipherSuite() { 44561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // do nothing 45561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes return null; 46561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 47561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 48561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes @Override 49561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public List<Certificate> getLocalCertificateChain() { 50561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // do nothing 51561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes return null; 52561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 53561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 54561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes @Override 55561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public Principal getLocalPrincipal() { 56561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // do nothing 57561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes return null; 58561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 59561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 60561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes @Override 61561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public Principal getPeerPrincipal() throws SSLPeerUnverifiedException { 62561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // do nothing 63561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes return null; 64561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 65561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 66561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes @Override 67561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public List<Certificate> getServerCertificateChain() throws SSLPeerUnverifiedException { 68561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // do nothing 69561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes return null; 70561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 71561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 72561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes @Override 73561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public InputStream getBody() throws IOException { 74561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // do nothing 75561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes return null; 76561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 77561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 78561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes @Override 79561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes public Map<String, List<String>> getHeaders() throws IOException { 80561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes // do nothing 81561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes return null; 82561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 83561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes 84561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes } 85561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes} 86