@SuppressWarnings("resource") // Closing the socket will close the underlying channel. public static Socket newSocket(InetAddress endpoint) throws IOException { // zero means 'bind on any available port.' if (isEncryptedChannel(endpoint)) { return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort()); } else { SocketChannel channel = SocketChannel.open(); channel.connect(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort())); return channel.socket(); } }
@SuppressWarnings("resource") // Closing the socket will close the underlying channel. public static Socket newSocket(InetAddress endpoint) throws IOException { // zero means 'bind on any available port.' if (isEncryptedChannel(endpoint)) { return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort()); } else { SocketChannel channel = SocketChannel.open(); channel.connect(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort())); return channel.socket(); } }
@SuppressWarnings("resource") // Closing the socket will close the underlying channel. public static Socket newSocket(InetAddress endpoint) throws IOException { // zero means 'bind on any available port.' if (isEncryptedChannel(endpoint)) { return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort()); } else { SocketChannel channel = SocketChannel.open(); channel.connect(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort())); return channel.socket(); } }
public static Socket newSocket(InetAddress endpoint) throws IOException { // zero means 'bind on any available port.' if (isEncryptedChannel(endpoint)) { if (Config.getOutboundBindAny()) return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort()); else return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort(), FBUtilities.getLocalAddress(), 0); } else { SocketChannel channel = SocketChannel.open(); if (!Config.getOutboundBindAny()) channel.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0)); channel.connect(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort())); return channel.socket(); } }