001 /*--------------------------------------------------------------------------+
002 $Id: LocalhostRMISocketFactory.java 29095 2010-07-05 14:36:27Z deissenb $
003 | |
004 | Copyright 2005-2010 Technische Universitaet Muenchen |
005 | |
006 | Licensed under the Apache License, Version 2.0 (the "License"); |
007 | you may not use this file except in compliance with the License. |
008 | You may obtain a copy of the License at |
009 | |
010 | http://www.apache.org/licenses/LICENSE-2.0 |
011 | |
012 | Unless required by applicable law or agreed to in writing, software |
013 | distributed under the License is distributed on an "AS IS" BASIS, |
014 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
015 | See the License for the specific language governing permissions and |
016 | limitations under the License. |
017 +--------------------------------------------------------------------------*/
018 package edu.tum.cs.commons.net;
019
020 import java.io.IOException;
021 import java.io.Serializable;
022 import java.net.Socket;
023
024 /**
025 * A socket factory that forces the host to use localhost.
026 *
027 * @author hummelb
028 * @author $Author: deissenb $
029 * @version $Rev: 29095 $
030 * @levd.rating GREEN Hash: E34D97B91B19CC8263CD8C2B34AFD884
031 */
032 public class LocalhostRMISocketFactory extends SmartRMISocketFactory implements
033 Serializable {
034
035 /** Constructor. No timeout is set. */
036 public LocalhostRMISocketFactory() {
037 // make call explicit here
038 super();
039 }
040
041 /** Constructor */
042 public LocalhostRMISocketFactory(int timeoutSeconds) {
043 super(timeoutSeconds);
044 }
045
046 /** {@inheritDoc} */
047 @Override
048 public Socket createSocket(String host, int port) throws IOException {
049 return super.createSocket("localhost", port);
050 }
051 }