1 18 19 package org.apache.activemq.transport.tcp; 20 21 import java.io.IOException ; 22 23 import javax.net.ssl.HandshakeCompletedListener; 24 import javax.net.ssl.SSLSession; 25 import javax.net.ssl.SSLSocket; 26 27 public class StubSSLSocket extends SSLSocket { 28 29 public static final int UNTOUCHED = -1; 30 public static final int FALSE = 0; 31 public static final int TRUE = 1; 32 33 private int wantClientAuthStatus = UNTOUCHED; 34 private int needClientAuthStatus = UNTOUCHED; 35 private int useClientModeStatus = UNTOUCHED; 36 37 final StubSSLSession session; 38 39 public StubSSLSocket(StubSSLSession ses) { 40 this.session = ses; 41 } 42 43 public void setWantClientAuth(boolean arg0) { 44 this.wantClientAuthStatus = (arg0 ? TRUE : FALSE); 45 } 46 47 public void setNeedClientAuth(boolean arg0) { 48 this.needClientAuthStatus = (arg0 ? TRUE : FALSE); 49 if ( session != null ) { 50 this.session.setIsVerified(arg0); 51 } 52 } 53 54 public void setUseClientMode(boolean arg0) { 55 useClientModeStatus = (arg0 ? TRUE : FALSE); 56 } 57 58 public boolean getWantClientAuth() { 59 return (wantClientAuthStatus == TRUE); 60 } 61 62 public boolean getNeedClientAuth() { 63 return (needClientAuthStatus == TRUE); 64 } 65 66 public boolean getUseClientMode() { 67 return (useClientModeStatus == TRUE ); 68 } 69 70 public int getWantClientAuthStatus() { 71 return wantClientAuthStatus; 72 } 73 74 public int getNeedClientAuthStatus() { 75 return needClientAuthStatus; 76 } 77 78 public int getUseClientModeStatus() { 79 return useClientModeStatus; 80 } 81 82 public SSLSession getSession() { 83 return this.session; 84 } 85 86 87 89 public String [] getSupportedCipherSuites() { 90 return null; 91 } 92 93 public String [] getEnabledCipherSuites() { 94 return null; 95 } 96 97 public void setEnabledCipherSuites(String [] arg0) { 98 } 99 100 public String [] getSupportedProtocols() { 101 return null; 102 } 103 104 public String [] getEnabledProtocols() { 105 return null; 106 } 107 108 public void setEnabledProtocols(String [] arg0) { 109 } 110 111 public void addHandshakeCompletedListener(HandshakeCompletedListener arg0) { 112 } 113 114 public void removeHandshakeCompletedListener(HandshakeCompletedListener arg0) { 115 } 116 117 public void startHandshake() throws IOException { 118 } 119 120 public void setEnableSessionCreation(boolean arg0) { 121 } 122 123 public boolean getEnableSessionCreation() { 124 return false; 125 } 126 127 } 128 | Popular Tags |