1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package libcore.javax.net.ssl; 18 19 import javax.net.ssl.SSLSession; 20 import javax.net.ssl.SSLSessionContext; 21 import java.security.cert.Certificate; 22 import java.security.Principal; 23 24 public class FakeSSLSession implements SSLSession { 25 final String host; 26 27 public FakeSSLSession(String host) { 28 this.host = host; 29 } 30 31 public int getApplicationBufferSize() { 32 throw new UnsupportedOperationException(); 33 } 34 35 public String getCipherSuite() { 36 throw new UnsupportedOperationException(); 37 } 38 39 public long getCreationTime() { 40 throw new UnsupportedOperationException(); 41 } 42 43 public byte[] getId() { 44 return host.getBytes(); 45 } 46 47 public long getLastAccessedTime() { 48 throw new UnsupportedOperationException(); 49 } 50 51 public Certificate[] getLocalCertificates() { 52 throw new UnsupportedOperationException(); 53 } 54 55 public Principal getLocalPrincipal() { 56 throw new UnsupportedOperationException(); 57 } 58 59 public int getPacketBufferSize() { 60 throw new UnsupportedOperationException(); 61 } 62 63 public javax.security.cert.X509Certificate[] getPeerCertificateChain() { 64 throw new UnsupportedOperationException(); 65 } 66 67 public Certificate[] getPeerCertificates() { 68 throw new UnsupportedOperationException(); 69 } 70 71 public String getPeerHost() { 72 return host; 73 } 74 75 public int getPeerPort() { 76 return 443; 77 } 78 79 public Principal getPeerPrincipal() { 80 throw new UnsupportedOperationException(); 81 } 82 83 public String getProtocol() { 84 throw new UnsupportedOperationException(); 85 } 86 87 public SSLSessionContext getSessionContext() { 88 throw new UnsupportedOperationException(); 89 } 90 91 public Object getValue(String name) { 92 throw new UnsupportedOperationException(); 93 } 94 95 public String[] getValueNames() { 96 throw new UnsupportedOperationException(); 97 } 98 99 public void invalidate() { 100 throw new UnsupportedOperationException(); 101 } 102 103 public boolean isValid() { 104 throw new UnsupportedOperationException(); 105 } 106 107 public void putValue(String name, Object value) { 108 throw new UnsupportedOperationException(); 109 } 110 111 public void removeValue(String name) { 112 throw new UnsupportedOperationException(); 113 } 114 } 115