why not just?:

````
if("tcp".equals(transport)) {
    channel = SocketChannel.open();
}
else {
    channel = DatagramChannel.open();
}
channel.connect(connectAddr);
```

Also, notice the XD formatting rules (from Spring in general) have a newline for 'else' after the brace.