Java Code Examples for java.net.Socket#isBound()
The following examples show how to use
java.net.Socket#isBound() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseWssSocketBuilder.java From Java-OCA-OCPP with MIT License | 6 votes |
@Override public Socket build() throws IOException { verify(true); Socket socket = socketFactory.getSocket(proxy); socket.setTcpNoDelay(tcpNoDelay); socket.setReuseAddress(reuseAddr); if (!socket.isBound()) { socket.connect( inetSocketAddressFactory.getInetSocketAddress(uri.getHost(), getPort(uri)), connectionTimeout); } return sslSocketFactory.createSocket(socket, uri.getHost(), getPort(uri), autoClose); }
Example 2
Source File: BulkLoadConnectionFactory.java From stratio-cassandra with Apache License 2.0 | 6 votes |
public Socket createConnection(InetAddress peer) throws IOException { // Connect to secure port for all peers if ServerEncryptionOptions is configured other than 'none' // When 'all', 'dc' and 'rack', server nodes always have SSL port open, and since thin client like sstableloader // does not know which node is in which dc/rack, connecting to SSL port is always the option. if (encryptionOptions != null && encryptionOptions.internode_encryption != EncryptionOptions.ServerEncryptionOptions.InternodeEncryption.none) { if (outboundBindAny) return SSLFactory.getSocket(encryptionOptions, peer, secureStoragePort); else return SSLFactory.getSocket(encryptionOptions, peer, secureStoragePort, FBUtilities.getLocalAddress(), 0); } else { Socket socket = SocketChannel.open(new InetSocketAddress(peer, storagePort)).socket(); if (outboundBindAny && !socket.isBound()) socket.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0)); return socket; } }
Example 3
Source File: OutboundTcpConnectionPool.java From stratio-cassandra with Apache License 2.0 | 6 votes |
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 { Socket socket = SocketChannel.open(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort())).socket(); if (Config.getOutboundBindAny() && !socket.isBound()) socket.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0)); return socket; } }
Example 4
Source File: AbstractMqttChannel.java From xenqtt with Apache License 2.0 | 5 votes |
/** * @see net.xenqtt.message.MqttChannel#getRemoteAddress() */ @Override public final String getRemoteAddress() { if (remoteAddress == null) { Socket socket = channel.socket(); SocketAddress address = socket.isBound() ? socket.getRemoteSocketAddress() : null; if (address == null) { return "N/A"; } remoteAddress = address.toString(); } return remoteAddress; }
Example 5
Source File: RpcSocketPool.java From p4ic4idea with Apache License 2.0 | 4 votes |
private boolean isAlive(Socket socket) { return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && !socket.isOutputShutdown(); }
Example 6
Source File: RpcSocketPool.java From p4ic4idea with Apache License 2.0 | 4 votes |
private boolean isAlive(Socket socket) { return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && !socket.isOutputShutdown(); }
Example 7
Source File: RpcSocketPool.java From p4ic4idea with Apache License 2.0 | 4 votes |
private boolean isAlive(Socket socket) { return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && !socket.isOutputShutdown(); }
Example 8
Source File: RpcSocketPool.java From p4ic4idea with Apache License 2.0 | 4 votes |
private boolean isAlive(Socket socket) { return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && !socket.isOutputShutdown(); }
Example 9
Source File: RpcSocketPool.java From p4ic4idea with Apache License 2.0 | 4 votes |
private boolean isAlive(Socket socket) { return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && !socket.isOutputShutdown(); }
Example 10
Source File: RpcSocketPool.java From p4ic4idea with Apache License 2.0 | 4 votes |
private boolean isAlive(Socket socket) { return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && !socket.isOutputShutdown(); }