@Override public InetSocketAddress getLocalAddress() { if (binding.getOptionalSourceAddress() != null) { return new InetSocketAddress(binding.getOptionalSourceAddress(), binding.getAbsoluteSourcePort() == null ? 0 : binding.getAbsoluteSourcePort()); } else if (binding.getAbsoluteSourcePort() != null) { // Bind to port only if source address is not configured return new InetSocketAddress(binding.getAbsoluteSourcePort()); } // No binding configured so don't bind return null; }
@Override public InetSocketAddress getLocalAddress() { if (binding.getOptionalSourceAddress() != null) { return new InetSocketAddress(binding.getOptionalSourceAddress(), binding.getAbsoluteSourcePort() == null ? 0 : binding.getAbsoluteSourcePort()); } else if (binding.getAbsoluteSourcePort() != null) { // Bind to port only if source address is not configured return new InetSocketAddress(binding.getAbsoluteSourcePort()); } // No binding configured so don't bind return null; }
private SocketAddress getOptionalSourceSocketAddress() { final InetAddress sourceAddress = this.getSourceAddress(); final Integer absoluteSourcePort = this.getAbsoluteSourcePort(); if (sourceAddress == null && absoluteSourcePort == null) { return null; } if (sourceAddress == null) { return new InetSocketAddress(absoluteSourcePort); } return new InetSocketAddress(sourceAddress, absoluteSourcePort); }
private SocketAddress getOptionalSourceSocketAddress() { final InetAddress sourceAddress = this.getSourceAddress(); final Integer absoluteSourcePort = this.getAbsoluteSourcePort(); if (sourceAddress == null && absoluteSourcePort == null) { return null; } if (sourceAddress == null) { return new InetSocketAddress(absoluteSourcePort); } return new InetSocketAddress(sourceAddress, absoluteSourcePort); }
private SocketAddress getOptionalSourceSocketAddress() { final InetAddress sourceAddress = this.getOptionalSourceAddress(); final Integer absoluteSourcePort = this.getAbsoluteSourcePort(); if (sourceAddress == null && absoluteSourcePort == null) { return null; } if (sourceAddress == null) { return new InetSocketAddress(absoluteSourcePort); } return new InetSocketAddress(sourceAddress, absoluteSourcePort); }
tc.getParams().put(TransportConstants.LOCAL_PORT_PROP_NAME, binding.getAbsoluteSourcePort());
tc.getParams().put(TransportConstants.LOCAL_PORT_PROP_NAME, binding.getAbsoluteSourcePort());