1 18 19 package org.apache.activemq.transport.tcp; 20 21 import org.apache.activemq.wireformat.WireFormat; 22 import org.apache.activemq.transport.Transport; 23 24 import java.io.IOException ; 25 import java.net.Socket ; 26 import java.net.URI ; 27 import java.net.URISyntaxException ; 28 29 import javax.net.ssl.SSLServerSocket; 30 import javax.net.ssl.SSLServerSocketFactory; 31 import javax.net.ssl.SSLSocket; 32 33 41 public class SslTransportServer extends TcpTransportServer { 42 43 private boolean needClientAuth = false; 45 46 private boolean wantClientAuth = false; 48 49 50 60 public SslTransportServer( 61 SslTransportFactory transportFactory, 62 URI location, 63 SSLServerSocketFactory serverSocketFactory) throws IOException , URISyntaxException { 64 super(transportFactory, location, serverSocketFactory); 65 } 66 67 73 public void setNeedClientAuth(boolean needAuth) { 74 this.needClientAuth = needAuth; 75 } 76 77 80 public boolean getNeedClientAuth() { 81 return this.needClientAuth; 82 } 83 84 87 public boolean getWantClientAuth() { 88 return this.wantClientAuth; 89 } 90 91 97 public void setWantClientAuth(boolean wantAuth) { 98 this.wantClientAuth = wantAuth; 99 } 100 101 108 public void bind() throws IOException { 109 super.bind(); 110 ((SSLServerSocket)this.serverSocket).setWantClientAuth(wantClientAuth); 111 ((SSLServerSocket)this.serverSocket).setNeedClientAuth(needClientAuth); 112 } 113 114 124 protected Transport createTransport(Socket socket, WireFormat format) throws IOException { 125 return new SslTransport(format, (SSLSocket)socket); 126 } 127 } 128 | Popular Tags |