Java 8 SocketAddress - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SocketAddress class.

This code example shows how to use the following methods:
  public HybridTransport(MessageCodec codec, int port) {
    this(codec, new InetSocketAddress(port));
  } 
 
  public HybridTransport(MessageCodec codec, SocketAddress bindaddr) {
    super(codec, bindaddr);
    socket = new SocketTransport(codec, bindaddr);
  } 
 
  @Override 
  public void close() { 
    super.close(); 
    IoUtils.close(socket);
  } 
   
  @Override 
  public void bind(TransportCallback callback) throws IOException {
    super.bind(callback);
    socket.bind(callback);
  } 
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.NoConnectionPendingException#NoConnectionPendingException()} 
     */ 
    public void test_Constructor() { 
        NoConnectionPendingException e = new NoConnectionPendingException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.COMPLETE, 
            notes = "Verifies serialization/deserialization compatibility.", 
            method = "!SerializationSelf", 
            args = {} 
7
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.NoConnectionPendingException#NoConnectionPendingException()} 
     */ 
    public void test_Constructor() { 
        NoConnectionPendingException e = new NoConnectionPendingException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception { 
 
        SerializationTest.verifySelf(new NoConnectionPendingException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:
        connectionPending = false;
        return true; 
      } 
 
    if (!connectionPending)
      throw new NoConnectionPendingException();
 
    return false; 
  } 
 
  public boolean isConnected() 
  { 
    // Wait until finishConnect is called before transitioning to 
    // connected. 
    if (connectionPending)
      return false; 
    try 
      { 
        InetSocketAddress remote = channel.getPeerAddress();
        return remote != null;
4
CodeRank
This code example shows how to use the following methods:
  public HybridTransport(MessageCodec codec, int port) {
    this(codec, new InetSocketAddress(port));
  } 
 
  public HybridTransport(MessageCodec codec, SocketAddress bindaddr) {
    super(codec, bindaddr);
    socket = new SocketTransport(codec, bindaddr);
  } 
 
  @Override 
  public void close() { 
    super.close(); 
    IoUtils.close(socket);
  } 
   
  @Override 
  public void bind(TransportCallback callback) throws IOException {
    super.bind(callback);
    socket.bind(callback);
  } 
5
CodeRank
This code example shows how to use the following methods:equals
        super.setInterestOpsNow(interestOps);
    } 
 
    @Override 
    public ChannelFuture write(Object message, SocketAddress remoteAddress) {
        if (remoteAddress == null || remoteAddress.equals(getRemoteAddress())) {
            return super.write(message, null); 
        } else { 
            return super.write(message, remoteAddress);
        } 
    } 
 
    public boolean isBound() { 
        return isOpen() && isSocketBound(); 
    } 
 
    public boolean isConnected() { 
        return isOpen() && isSocketConnected(); 
    } 
 
5
CodeRank

Related Java 8 SocketAddress Questions & Answers:

See Code Examples for Java 8 SocketAddress Methods: