Example usage for org.springframework.integration.ip AbstractInternetProtocolReceivingChannelAdapter setLocalAddress

List of usage examples for org.springframework.integration.ip AbstractInternetProtocolReceivingChannelAdapter setLocalAddress

Introduction

In this page you can find the example usage for org.springframework.integration.ip AbstractInternetProtocolReceivingChannelAdapter setLocalAddress.

Prototype

@Override
    public void setLocalAddress(String localAddress) 

Source Link

Usage

From source file:org.springframework.integration.ip.util.SocketTestUtils.java

public static void setLocalNicIfPossible(AbstractInternetProtocolReceivingChannelAdapter adapter)
        throws UnknownHostException {
    InetAddress[] nics = InetAddress.getAllByName(null);
    if (nics.length > 0) {
        // just listen on the loopback interface
        String loopBack = nics[0].getHostAddress();
        adapter.setLocalAddress(loopBack);
    }// w ww .  j ava 2s.c  om
}