*/
private FuturePing ping(PeerAddress peerAddress, final boolean isUDP) {
final FuturePing futurePing = new FuturePing();
final RequestHandler<FutureResponse> request = peer.pingRPC().ping(peerAddress, connectionConfiguration);
if (isUDP) {
FutureChannelCreator fcc = peer.connectionBean().reservation().create(1, 0);
Utils.addReleaseListener(fcc, futurePing);
fcc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
@Override
public void operationComplete(final FutureChannelCreator future) throws Exception {
if (future.isSuccess()) {
FutureResponse futureResponse = request.sendUDP(future.channelCreator());
addPingListener(futurePing, futureResponse);
} else {
futurePing.failed(future);
}
}
});
} else {
FutureChannelCreator fcc = peer.connectionBean().reservation().create(0, 1);
Utils.addReleaseListener(fcc, futurePing);
fcc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
@Override
public void operationComplete(final FutureChannelCreator future) throws Exception {
if (future.isSuccess()) {
FutureResponse futureResponse = request.sendTCP(future.channelCreator());
addPingListener(futurePing, futureResponse);