1 18 19 package org.apache.activemq.transport.tcp; 20 21 import java.security.Principal ; 22 import java.security.cert.Certificate ; 23 import java.security.cert.X509Certificate ; 24 25 import javax.net.ssl.SSLPeerUnverifiedException; 26 import javax.net.ssl.SSLSession; 27 import javax.net.ssl.SSLSessionContext; 28 29 class StubSSLSession implements SSLSession { 30 31 X509Certificate cert; 32 boolean isVerified = false; 33 34 public StubSSLSession(X509Certificate cert) { 35 if ( cert != null ) { 36 this.isVerified = true; 37 this.cert = cert; 38 } else { 39 this.isVerified = false; 40 this.cert = null; 41 } 42 } 43 44 public void setIsVerified( boolean verified ) { 45 this.isVerified = verified; 46 } 47 48 public Certificate [] getPeerCertificates() throws SSLPeerUnverifiedException { 49 if ( this.isVerified ) 50 return new X509Certificate [] { this.cert }; 51 else 52 throw new SSLPeerUnverifiedException("Socket is unverified."); 53 } 54 55 56 58 public byte[] getId() { 59 return null; 60 } 61 62 public SSLSessionContext getSessionContext() { 63 return null; 64 } 65 66 public long getCreationTime() { 67 return 0; 68 } 69 70 public long getLastAccessedTime() { 71 return 0; 72 } 73 74 public void invalidate() { 75 } 76 77 public boolean isValid() { 78 return false; 79 } 80 81 public void putValue(String arg0, Object arg1) { 82 } 83 84 public Object getValue(String arg0) { 85 return null; 86 } 87 88 public void removeValue(String arg0) { 89 } 90 91 public String [] getValueNames() { 92 return null; 93 } 94 95 public Certificate [] getLocalCertificates() { 96 return null; 97 } 98 99 public javax.security.cert.X509Certificate[] getPeerCertificateChain() 100 throws SSLPeerUnverifiedException { 101 return null; 102 } 103 104 public Principal getPeerPrincipal() throws SSLPeerUnverifiedException { 105 return null; 106 } 107 108 public Principal getLocalPrincipal() { 109 return null; 110 } 111 112 public String getCipherSuite() { 113 return null; 114 } 115 116 public String getProtocol() { 117 return null; 118 } 119 120 public String getPeerHost() { 121 return null; 122 } 123 124 public int getPeerPort() { 125 return 0; 126 } 127 128 public int getPacketBufferSize() { 129 return 0; 130 } 131 132 public int getApplicationBufferSize() { 133 return 0; 134 } 135 } 136 | Popular Tags |