/** * Gets the server socket factory. * <p> * Subclasses may override to provide a custom factory. * @return server socket factory * @throws Exception */ protected ServerSocketFactory getServerSocketFactory() throws Exception { return ServerSocketFactory.getDefault(); }
protected SocketFactory getSocketFactory() { return SocketFactory.getDefault(); }
/** * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int) */ public Socket createSocket(String host, int port) throws IOException, UnknownHostException { return SSLSocketFactory.getDefault().createSocket( host, port ); }
@Override public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException { return socketFactory.createSocket(address, port, localAddress, localPort); } }
public JRMPListener ( int port, Object payloadObject ) throws NumberFormatException, IOException { this.port = port; this.payloadObject = payloadObject; this.ss = ServerSocketFactory.getDefault().createServerSocket(this.port); }
/** * Creates a new TelnetTerminalServer on a specific port through a ServerSocketFactory with a certain Charset * @param serverSocketFactory ServerSocketFactory to use when creating the ServerSocket * @param port Port to listen for incoming telnet connections * @param charset Character set to use * @throws IOException If there was an underlying I/O exception */ public TelnetTerminalServer(ServerSocketFactory serverSocketFactory, int port, Charset charset) throws IOException { this.serverSocket = serverSocketFactory.createServerSocket(port); this.charset = charset; }
/** * Gets the default socket factory of the system which can be used to create * new sockets without creating a subclass of this factory. * * @return the system default socket factory. */ public static synchronized SocketFactory getDefault() { if (defaultFactory == null) { defaultFactory = new DefaultSocketFactory(); } return defaultFactory; }
/** * Gets the default server socket factory of the system which can be used to * create new server sockets without creating a subclass of this factory. * * @return the system default server socket factory. */ public static synchronized ServerSocketFactory getDefault() { if (defaultFactory == null) { defaultFactory = new DefaultServerSocketFactory(); } return defaultFactory; }
@Override public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException { return socketFactory.createSocket(host, port, localHost, localPort); }
@Override protected boolean isPortAvailable(int port) { try { ServerSocket serverSocket = ServerSocketFactory.getDefault().createServerSocket( port, 1, InetAddress.getByName("localhost")); serverSocket.close(); return true; } catch (Exception ex) { return false; } } },
public GraphiteReporter(InetSocketAddress address, String prefix) { this.prefix = prefix; this.address = address; this.socketFactory = SocketFactory.getDefault(); }
/** * Gets the platform default {@link ServerSocketFactory}. * <p> * Subclasses may override to provide a custom server socket factory. */ protected ServerSocketFactory getServerSocketFactory() { return ServerSocketFactory.getDefault(); }
@Override public Socket createSocket(InetAddress host, int port) throws IOException { return socketFactory.createSocket(host, port); }
public static boolean isTcpPortAvailable(int port) { try { ServerSocket serverSocket = ServerSocketFactory.getDefault().createServerSocket(port, 1, InetAddress.getByName("localhost")); serverSocket.close(); return true; } catch (Exception ex) { return false; } }
protected SocketFactory socketFactory() { return SocketFactory.getDefault(); }
@Override public Socket createSocket() throws IOException { return socketFactory.createSocket(); }
public static synchronized int findFreePort() throws IOException { try (ServerSocket socket = ServerSocketFactory.getDefault().createServerSocket(0)) { return socket.getLocalPort(); } }
public void setSocketFactory(SocketFactory factory) { if (factory == null) { socketFactory = SocketFactory.getDefault(); } else { socketFactory = factory; } }
@Override public Socket createSocket(String host, int port) throws IOException { return socketFactory.createSocket(host, port); }
public Socket createSocket(final InetAddress arg0, final int arg1, final InetAddress arg2, final int arg3) throws IOException { return skipSSLCheckFactory.createSocket(arg0, arg1, arg2, arg3); } }