KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > remote > rmi > SSLRMIServerSocketFactory


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.tools.remote.rmi;
10
11 import java.io.IOException JavaDoc;
12 import java.net.ServerSocket JavaDoc;
13 import java.rmi.server.RMIServerSocketFactory JavaDoc;
14 import javax.net.ssl.SSLContext;
15 import javax.net.ssl.SSLServerSocketFactory;
16
17 /**
18  * @version $Revision: 1.4 $
19  */

20 public class SSLRMIServerSocketFactory implements RMIServerSocketFactory JavaDoc
21 {
22    private final SSLContext sslContext;
23    private final int backlog;
24
25    public SSLRMIServerSocketFactory(SSLContext sslContext)
26    {
27       this(sslContext, 50);
28    }
29
30    public SSLRMIServerSocketFactory(SSLContext sslContext, int backlog)
31    {
32       this.sslContext = sslContext;
33       this.backlog = backlog;
34    }
35
36    public ServerSocket JavaDoc createServerSocket(int port) throws IOException JavaDoc
37    {
38       SSLServerSocketFactory factory = sslContext.getServerSocketFactory();
39       return factory.createServerSocket(port, backlog);
40    }
41 }
42
Popular Tags