/** * Creates a default TCP transport mapping with the server for incoming * messages disabled. * @throws IOException * on failure of binding a local port. */ public DefaultTcpTransportMapping() throws IOException { super(new TcpAddress(InetAddress.getLocalHost(), 0)); }
@Override public TcpAddress getListenAddress() { int port = tcpAddress.getPort(); ServerThread serverThreadCopy = serverThread; try { port = serverThreadCopy.ssc.socket().getLocalPort(); } catch (NullPointerException npe) { // ignore } return new TcpAddress(tcpAddress.getInetAddress(), port); }
public static Address parse(String address) { try { TcpAddress a = new TcpAddress(); if (a.parseAddress(address)) { return a; } } catch (Exception ex) { logger.error(ex); } return null; }
/** * Create a {@link TlsAddress} from a {@link TcpAddress}. * @param tcpAddress * the {@link TcpAddress} for the new {@link TlsAddress}. * @since 3.0.5 */ public TlsAddress(TcpAddress tcpAddress) { super(tcpAddress.getInetAddress(), tcpAddress.getPort()); }
public TcpAddress(InetAddress inetAddress, int port) { setInetAddress(inetAddress); setPort(port); }
public TcpAddress(String address) { if (!parseAddress(address)) { throw new IllegalArgumentException(address); } }
public TcpAddress(int port) { super(); setPort(port); }
public boolean equals(Object o) { return (o instanceof TlsAddress) && super.equals(o); }
public ServerThread() throws IOException, NoSuchAlgorithmException { // Selector for incoming requests selector = Selector.open(); if (serverEnabled) { // Create a new server socket and set to non blocking mode ssc = ServerSocketChannel.open(); ssc.configureBlocking(false); // Bind the server socket InetSocketAddress isa = new InetSocketAddress(tcpAddress.getInetAddress(), tcpAddress.getPort()); setSocketOptions(ssc.socket()); ssc.socket().bind(isa); // Register accepts on the server socket with the selector. This // step tells the selector that the socket wants to be put on the // ready list when accept operations occur, so allowing multiplexed // non-blocking I/O to take place. ssc.register(selector, SelectionKey.OP_ACCEPT); } }
public TcpAddress(InetAddress inetAddress, int port) { setInetAddress(inetAddress); setPort(port); }
public TcpAddress(String address) { if (!parseAddress(address)) { throw new IllegalArgumentException(address); } }
public TcpAddress(int port) { super(); setPort(port); }
public boolean equals(Object o) { return (o instanceof TlsAddress) && super.equals(o); }
/** * Creates a default TCP transport mapping with the server for incoming * messages disabled. * * @throws IOException * on failure of binding a local port. */ public DefaultTcpTransportMapping() throws IOException { super(new TcpAddress(InetAddress.getLocalHost(), 0)); }
@Override public TcpAddress getListenAddress() { int port = tcpAddress.getPort(); ServerThread serverThreadCopy = serverThread; try { port = ((InetSocketAddress) serverThreadCopy.ssc.getLocalAddress()).getPort(); } catch (NullPointerException npe) { // ignore } catch (IOException e) { e.printStackTrace(); } return new TcpAddress(tcpAddress.getInetAddress(), port); }
public ServerThread() throws IOException, NoSuchAlgorithmException { super(TLSTM.this); // Selector for incoming requests if (serverEnabled) { // Create a new server socket and set to non blocking mode ssc = ServerSocketChannel.open(); ssc.configureBlocking(false); // Bind the server socket InetSocketAddress isa = new InetSocketAddress(tcpAddress.getInetAddress(), tcpAddress.getPort()); setSocketOptions(ssc.socket()); ssc.socket().bind(isa); // Register accepts on the server socket with the selector. This // step tells the selector that the socket wants to be put on the // ready list when accept operations occur, so allowing multiplexed // non-blocking I/O to take place. ssc.register(selector, SelectionKey.OP_ACCEPT); } }
public static Address parse(String address) { try { TcpAddress a = new TcpAddress(); if (a.parseAddress(address)) { return a; } } catch (Exception ex) { logger.error(ex); } return null; }
public TcpAddress(InetAddress inetAddress, int port) { setInetAddress(inetAddress); setPort(port); }
public TcpAddress(String address) { if (!parseAddress(address)) { throw new IllegalArgumentException(address); } }
public TcpAddress(int port) { super(); setPort(port); }