-/**
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
+
package org.opendaylight.openflowjava.protocol.impl.connection;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.util.concurrent.GenericFutureListener;
-import java.util.Collection;
+import java.net.InetSocketAddress;
import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import org.opendaylight.controller.sal.common.util.RpcErrors;
-import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Preconditions;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalCause;
import com.google.common.cache.RemovalListener;
import com.google.common.cache.RemovalNotification;
-import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
/**
+ * Handles messages (notifications + rpcs) and connections
* @author mirehak
* @author michal.polkorab
*/
-public class ConnectionAdapterImpl implements CommunicationFacade {
-
- /** after this time, rpc future response objects will be thrown away (in minutes) */
+public class ConnectionAdapterImpl implements ConnectionFacade {
+ /** after this time, RPC future response objects will be thrown away (in minutes) */
public static final int RPC_RESPONSE_EXPIRATION = 1;
- protected static final Logger LOG = LoggerFactory
+ /**
+ * Default depth of write queue, e.g. we allow these many messages
+ * to be queued up before blocking producers.
+ */
+ public static final int DEFAULT_QUEUE_DEPTH = 1024;
+
+ private static final Logger LOG = LoggerFactory
.getLogger(ConnectionAdapterImpl.class);
-
+ private static final Exception QUEUE_FULL_EXCEPTION =
+ new RejectedExecutionException("Output queue is full");
+
private static final String APPLICATION_TAG = "OPENFLOW_LIBRARY";
private static final String TAG = "OPENFLOW";
- private Channel channel;
- private OpenflowProtocolListener messageListener;
- private int version;
+ private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =
+ new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {
+
+ @Override
+ public void onRemoval(
+ final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {
+ if (! notification.getCause().equals(RemovalCause.EXPLICIT)) {
+ notification.getValue().discard();
+ }
+ }
+ };
+
/** expiring cache for future rpcResponses */
- protected Cache<RpcResponseKey, SettableFuture<?>> responseCache;
-
-
+ private final Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> responseCache;
+
+ private final ChannelOutboundQueue output;
+ private final Channel channel;
+
+ private ConnectionReadyListener connectionReadyListener;
+ private OpenflowProtocolListener messageListener;
+ private SystemNotificationsListener systemListener;
+ private boolean disconnectOccured = false;
+
/**
- * default ctor
+ * default ctor
+ * @param channel the channel to be set - used for communication
+ * @param address client address (used only in case of UDP communication,
+ * as there is no need to store address over tcp (stable channel))
*/
- public ConnectionAdapterImpl() {
+ public ConnectionAdapterImpl(final Channel channel, final InetSocketAddress address) {
responseCache = CacheBuilder.newBuilder()
.concurrencyLevel(1)
.expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
- .removalListener(new RemovalListener<RpcResponseKey, SettableFuture<?>>() {
-
- @Override
- public void onRemoval(
- RemovalNotification<RpcResponseKey, SettableFuture<?>> notification) {
- LOG.warn("rpc response discarded: "+notification.getKey());
- notification.getValue().cancel(true);
- }
- }).build();
- LOG.info("ConnectionAdapter created");
- }
-
- /**
- * @param channel the channel to be set - used for communication
- */
- @Override
- public void setChannel(Channel channel) {
- this.channel = channel;
+ .removalListener(REMOVAL_LISTENER).build();
+ this.channel = Preconditions.checkNotNull(channel);
+ this.output = new ChannelOutboundQueue(channel, DEFAULT_QUEUE_DEPTH);
+ output.setAddress(address);
+ channel.pipeline().addLast(output);
+ LOG.debug("ConnectionAdapter created");
}
@Override
- public Future<RpcResult<BarrierOutput>> barrier(BarrierInput input) {
+ public Future<RpcResult<BarrierOutput>> barrier(final BarrierInput input) {
return sendToSwitchExpectRpcResultFuture(
input, BarrierOutput.class, "barrier-input sending failed");
}
@Override
- public Future<RpcResult<EchoOutput>> echo(EchoInput input) {
+ public Future<RpcResult<EchoOutput>> echo(final EchoInput input) {
return sendToSwitchExpectRpcResultFuture(
input, EchoOutput.class, "echo-input sending failed");
}
@Override
- public Future<RpcResult<Void>> echoReply(EchoReplyInput input) {
+ public Future<RpcResult<Void>> echoReply(final EchoReplyInput input) {
return sendToSwitchFuture(input, "echo-reply sending failed");
}
@Override
- public Future<RpcResult<Void>> experimenter(ExperimenterInput input) {
+ public Future<RpcResult<Void>> experimenter(final ExperimenterInput input) {
return sendToSwitchFuture(input, "experimenter sending failed");
}
@Override
- public Future<RpcResult<Void>> flowMod(FlowModInput input) {
+ public Future<RpcResult<Void>> flowMod(final FlowModInput input) {
return sendToSwitchFuture(input, "flow-mod sending failed");
}
@Override
- public Future<RpcResult<GetConfigOutput>> getConfig(GetConfigInput input) {
+ public Future<RpcResult<GetConfigOutput>> getConfig(final GetConfigInput input) {
return sendToSwitchExpectRpcResultFuture(
input, GetConfigOutput.class, "get-config-input sending failed");
}
@Override
public Future<RpcResult<GetFeaturesOutput>> getFeatures(
- GetFeaturesInput input) {
+ final GetFeaturesInput input) {
return sendToSwitchExpectRpcResultFuture(
input, GetFeaturesOutput.class, "get-features-input sending failed");
}
@Override
public Future<RpcResult<GetQueueConfigOutput>> getQueueConfig(
- GetQueueConfigInput input) {
+ final GetQueueConfigInput input) {
return sendToSwitchExpectRpcResultFuture(
input, GetQueueConfigOutput.class, "get-queue-config-input sending failed");
}
@Override
- public Future<RpcResult<Void>> groupMod(GroupModInput input) {
+ public Future<RpcResult<Void>> groupMod(final GroupModInput input) {
return sendToSwitchFuture(input, "group-mod-input sending failed");
}
@Override
- public Future<RpcResult<Void>> hello(HelloInput input) {
+ public Future<RpcResult<Void>> hello(final HelloInput input) {
return sendToSwitchFuture(input, "hello-input sending failed");
}
@Override
- public Future<RpcResult<Void>> meterMod(MeterModInput input) {
+ public Future<RpcResult<Void>> meterMod(final MeterModInput input) {
return sendToSwitchFuture(input, "meter-mod-input sending failed");
}
@Override
- public Future<RpcResult<Void>> packetOut(PacketOutInput input) {
+ public Future<RpcResult<Void>> packetOut(final PacketOutInput input) {
return sendToSwitchFuture(input, "packet-out-input sending failed");
}
@Override
- public Future<RpcResult<Void>> portMod(PortModInput input) {
+ public Future<RpcResult<Void>> multipartRequest(final MultipartRequestInput input) {
+ return sendToSwitchFuture(input, "multi-part-request sending failed");
+ }
+
+ @Override
+ public Future<RpcResult<Void>> portMod(final PortModInput input) {
return sendToSwitchFuture(input, "port-mod-input sending failed");
}
@Override
public Future<RpcResult<RoleRequestOutput>> roleRequest(
- RoleRequestInput input) {
+ final RoleRequestInput input) {
return sendToSwitchExpectRpcResultFuture(
input, RoleRequestOutput.class, "role-request-config-input sending failed");
}
@Override
- public Future<RpcResult<Void>> setConfig(SetConfigInput input) {
+ public Future<RpcResult<Void>> setConfig(final SetConfigInput input) {
return sendToSwitchFuture(input, "set-config-input sending failed");
}
@Override
- public Future<RpcResult<Void>> tableMod(TableModInput input) {
+ public Future<RpcResult<Void>> tableMod(final TableModInput input) {
return sendToSwitchFuture(input, "table-mod-input sending failed");
}
@Override
- public Future<RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input) {
+ public Future<RpcResult<GetAsyncOutput>> getAsync(final GetAsyncInput input) {
return sendToSwitchExpectRpcResultFuture(
input, GetAsyncOutput.class, "get-async-input sending failed");
}
@Override
- public Future<RpcResult<Void>> setAsync(SetAsyncInput input) {
+ public Future<RpcResult<Void>> setAsync(final SetAsyncInput input) {
return sendToSwitchFuture(input, "set-async-input sending failed");
}
@Override
public Future<Boolean> disconnect() {
ChannelFuture disconnectResult = channel.disconnect();
-
+ responseCache.invalidateAll();
+ disconnectOccured = true;
+
String failureInfo = "switch disconnecting failed";
ErrorSeverity errorSeverity = ErrorSeverity.ERROR;
String message = "Check the switch connection";
}
@Override
- public void setMessageListener(OpenflowProtocolListener messageListener) {
+ public void setMessageListener(final OpenflowProtocolListener messageListener) {
this.messageListener = messageListener;
}
-
+
@Override
- public void consume(DataObject message) {
- if (message == null) {
- LOG.error("message is null");
- } else {
- LOG.debug("message is ok");
+ public void consume(final DataObject message) {
+ LOG.debug("ConsumeIntern msg");
+ if (disconnectOccured ) {
+ return;
}
if (message instanceof Notification) {
- if (message instanceof EchoRequestMessage) {
+ // System events
+ if (message instanceof DisconnectEvent) {
+ systemListener.onDisconnectEvent((DisconnectEvent) message);
+ responseCache.invalidateAll();
+ disconnectOccured = true;
+ } else if (message instanceof SwitchIdleEvent) {
+ systemListener.onSwitchIdleEvent((SwitchIdleEvent) message);
+ }
+ // OpenFlow messages
+ else if (message instanceof EchoRequestMessage) {
messageListener.onEchoRequestMessage((EchoRequestMessage) message);
} else if (message instanceof ErrorMessage) {
messageListener.onErrorMessage((ErrorMessage) message);
messageListener.onHelloMessage((HelloMessage) message);
} else if (message instanceof MultipartReplyMessage) {
messageListener.onMultipartReplyMessage((MultipartReplyMessage) message);
- } else if (message instanceof MultipartRequestMessage) {
- messageListener.onMultipartRequestMessage((MultipartRequestMessage) message);
} else if (message instanceof PacketInMessage) {
messageListener.onPacketInMessage((PacketInMessage) message);
} else if (message instanceof PortStatusMessage) {
messageListener.onPortStatusMessage((PortStatusMessage) message);
} else {
- LOG.warn("message listening not supported for type: "+message.getClass());
+ LOG.warn("message listening not supported for type: {}", message.getClass());
}
} else {
if (message instanceof OfHeader) {
+ LOG.debug("OFheader msg received");
RpcResponseKey key = createRpcResponseKey((OfHeader) message);
- SettableFuture<RpcResult<?>> rpcFuture = findRpcResponse(key);
- if (rpcFuture != null) {
- rpcFuture.set(Rpcs.getRpcResult(true, message, null));
+ final ResponseExpectedRpcListener<?> listener = findRpcResponse(key);
+ if (listener != null) {
+ LOG.debug("corresponding rpcFuture found");
+ listener.completed((OfHeader)message);
+ LOG.debug("after setting rpcFuture");
responseCache.invalidate(key);
} else {
- LOG.warn("received unexpected rpc response: "+key);
+ LOG.warn("received unexpected rpc response: {}", key);
}
-
} else {
- LOG.warn("message listening not supported for type: "+message.getClass());
+ LOG.warn("message listening not supported for type: {}", message.getClass());
}
}
}
+ private <T> ListenableFuture<RpcResult<T>> enqueueMessage(final AbstractRpcListener<T> promise) {
+ LOG.debug("Submitting promise {}", promise);
+
+ if (!output.enqueue(promise)) {
+ LOG.debug("Message queue is full, rejecting execution");
+ promise.failedRpc(QUEUE_FULL_EXCEPTION);
+ } else {
+ LOG.debug("Promise enqueued successfully");
+ }
+
+ return promise.getResult();
+ }
+
/**
* sends given message to switch, sending result will be reported via return value
* @param input message to send
- * @param failureInfo describes, what type of message caused failure by sending
+ * @param failureInfo describes, what type of message caused failure by sending
* @return future object, <ul>
- * <li>if send successful, {@link RpcResult} without errors and successful
+ * <li>if send successful, {@link RpcResult} without errors and successful
* status will be returned, </li>
* <li>else {@link RpcResult} will contain errors and failed status</li>
- * </ul>
+ * </ul>
*/
- private SettableFuture<RpcResult<Void>> sendToSwitchFuture(
- DataObject input, final String failureInfo) {
- ChannelFuture resultFuture = channel.writeAndFlush(input);
-
- ErrorSeverity errorSeverity = ErrorSeverity.ERROR;
- String errorMessage = "check switch connection";
- return handleRpcChannelFuture(resultFuture, failureInfo, errorSeverity, errorMessage);
+ private ListenableFuture<RpcResult<Void>> sendToSwitchFuture(
+ final DataObject input, final String failureInfo) {
+ return enqueueMessage(new SimpleRpcListener(input, failureInfo));
}
-
+
/**
* sends given message to switch, sending result or switch response will be reported via return value
* @param input message to send
* @param responseClazz type of response
- * @param failureInfo describes, what type of message caused failure by sending
+ * @param failureInfo describes, what type of message caused failure by sending
* @return future object, <ul>
* <li>if send fails, {@link RpcResult} will contain errors and failed status </li>
- * <li>else {@link RpcResult} will be stored in responseCache and wait for particular timeout
- * ({@link ConnectionAdapterImpl#RPC_RESPONSE_EXPIRATION}),
+ * <li>else {@link RpcResult} will be stored in responseCache and wait for particular timeout
+ * ({@link ConnectionAdapterImpl#RPC_RESPONSE_EXPIRATION}),
* <ul><li>either switch will manage to answer
* and then corresponding response message will be set into returned future</li>
* <li>or response in cache will expire and returned future will be cancelled</li></ul>
* </li>
- * </ul>
+ * </ul>
*/
- private <IN extends OfHeader, OUT extends OfHeader> SettableFuture<RpcResult<OUT>> sendToSwitchExpectRpcResultFuture(
- IN input, Class<OUT> responseClazz, final String failureInfo) {
- ChannelFuture resultFuture = channel.writeAndFlush(input);
-
- ErrorSeverity errorSeverity = ErrorSeverity.ERROR;
- String errorMessage = "check switch connection";
- return handleRpcChannelFutureWithResponse(resultFuture, failureInfo, errorSeverity,
- errorMessage, input, responseClazz);
+ private <IN extends OfHeader, OUT extends OfHeader> ListenableFuture<RpcResult<OUT>> sendToSwitchExpectRpcResultFuture(
+ final IN input, final Class<OUT> responseClazz, final String failureInfo) {
+ final RpcResponseKey key = new RpcResponseKey(input.getXid(), responseClazz.getName());
+ final ResponseExpectedRpcListener<OUT> listener =
+ new ResponseExpectedRpcListener<>(input, failureInfo, responseCache, key);
+ return enqueueMessage(listener);
}
/**
- * @param resultFuture
- * @param failureInfo
- * @return
- */
- private SettableFuture<RpcResult<Void>> handleRpcChannelFuture(
- ChannelFuture resultFuture, final String failureInfo,
- final ErrorSeverity errorSeverity, final String errorMessage) {
-
- final SettableFuture<RpcResult<Void>> rpcResult = SettableFuture.create();
-
- resultFuture.addListener(new GenericFutureListener<io.netty.util.concurrent.Future<? super Void>>() {
-
- @Override
- public void operationComplete(
- io.netty.util.concurrent.Future<? super Void> future)
- throws Exception {
- Collection<RpcError> errors = null;
-
- if (future.cause() != null) {
- RpcError rpcError = buildRpcError(failureInfo,
- errorSeverity, errorMessage, future.cause());
- errors = Lists.newArrayList(rpcError);
- }
-
- rpcResult.set(Rpcs.getRpcResult(
- future.isSuccess(),
- (Void) null,
- errors)
- );
- }
- });
- return rpcResult;
- }
-
- /**
- * @param input
- * @param responseClazz
* @param resultFuture
* @param failureInfo
* @param errorSeverity
- * @param errorMessage
- * @return
- */
- private <IN extends OfHeader, OUT extends OfHeader> SettableFuture<RpcResult<OUT>> handleRpcChannelFutureWithResponse(
- ChannelFuture resultFuture, final String failureInfo,
- final ErrorSeverity errorSeverity, final String errorMessage,
- final IN input, Class<OUT> responseClazz) {
- final SettableFuture<RpcResult<OUT>> rpcResult = SettableFuture.create();
-
- resultFuture.addListener(new GenericFutureListener<io.netty.util.concurrent.Future<? super Void>>() {
-
- @Override
- public void operationComplete(
- io.netty.util.concurrent.Future<? super Void> future)
- throws Exception {
-
- if (future.cause() != null) {
- Collection<RpcError> errors = null;
- RpcError rpcError = buildRpcError(failureInfo,
- errorSeverity, errorMessage, future.cause());
- errors = Lists.newArrayList(rpcError);
- rpcResult.set(Rpcs.getRpcResult(
- future.isSuccess(),
- (OUT) null,
- errors)
- );
- } else {
- RpcResponseKey key = new RpcResponseKey(input.getXid(), input.getClass().toString());
- if (responseCache.getIfPresent(key) != null) {
- responseCache.invalidate(key);
- }
- responseCache.put(key, rpcResult);
- }
- }
- });
- return rpcResult;
- }
-
- /**
- * @param resultFuture
- * @param failureInfo
- * @param errorSeverity
- * @param message
+ * @param message
* @return
*/
private static SettableFuture<Boolean> handleTransportChannelFuture(
- ChannelFuture resultFuture, final String failureInfo,
+ final ChannelFuture resultFuture, final String failureInfo,
final ErrorSeverity errorSeverity, final String message) {
-
+
final SettableFuture<Boolean> transportResult = SettableFuture.create();
-
+
resultFuture.addListener(new GenericFutureListener<io.netty.util.concurrent.Future<? super Void>>() {
-
+
@Override
public void operationComplete(
- io.netty.util.concurrent.Future<? super Void> future)
+ final io.netty.util.concurrent.Future<? super Void> future)
throws Exception {
transportResult.set(future.isSuccess());
- transportResult.setException(future.cause());
+ if (!future.isSuccess()) {
+ transportResult.setException(future.cause());
+ }
}
});
return transportResult;
* @param cause
* @return
*/
- protected RpcError buildRpcError(String info, ErrorSeverity severity, String message,
- Throwable cause) {
- RpcError error = RpcErrors.getRpcError(APPLICATION_TAG, TAG, info, severity, message,
+ static RpcError buildRpcError(final String info, final ErrorSeverity severity, final String message,
+ final Throwable cause) {
+ RpcError error = RpcErrors.getRpcError(APPLICATION_TAG, TAG, info, severity, message,
ErrorType.RPC, cause);
return error;
}
-
+
/**
* @param cause
* @return
*/
- protected RpcError buildTransportError(String info, ErrorSeverity severity, String message,
- Throwable cause) {
- RpcError error = RpcErrors.getRpcError(APPLICATION_TAG, TAG, info, severity, message,
+ protected static RpcError buildTransportError(final String info, final ErrorSeverity severity, final String message,
+ final Throwable cause) {
+ RpcError error = RpcErrors.getRpcError(APPLICATION_TAG, TAG, info, severity, message,
ErrorType.TRANSPORT, cause);
return error;
}
* @param message
* @return
*/
- private static RpcResponseKey createRpcResponseKey(OfHeader message) {
- return new RpcResponseKey(message.getXid(), message.getClass().toString());
+ private static RpcResponseKey createRpcResponseKey(final OfHeader message) {
+ return new RpcResponseKey(message.getXid(), message.getImplementedInterface().getName());
}
/**
* @return
*/
- @SuppressWarnings("unchecked")
- private SettableFuture<RpcResult<?>> findRpcResponse(RpcResponseKey key) {
- return (SettableFuture<RpcResult<?>>) responseCache.getIfPresent(key);
+ private ResponseExpectedRpcListener<?> findRpcResponse(final RpcResponseKey key) {
+ return responseCache.getIfPresent(key);
+ }
+
+ @Override
+ public void setSystemListener(final SystemNotificationsListener systemListener) {
+ this.systemListener = systemListener;
+ }
+
+ @Override
+ public void checkListeners() {
+ final StringBuilder buffer = new StringBuilder();
+ if (systemListener == null) {
+ buffer.append("SystemListener ");
+ }
+ if (messageListener == null) {
+ buffer.append("MessageListener ");
+ }
+ if (connectionReadyListener == null) {
+ buffer.append("ConnectionReadyListener ");
+ }
+
+ Preconditions.checkState(buffer.length() == 0, "Missing listeners: %s", buffer.toString());
}
- /* (non-Javadoc)
- * @see org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter#setVersion(int)
- */
@Override
- public void setVersion(int version) {
- this.version = version;
+ public void fireConnectionReadyNotification() {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ connectionReadyListener.onConnectionReady();
+ }
+ }).start();
}
+
+ @Override
+ public void setConnectionReadyListener(
+ final ConnectionReadyListener connectionReadyListener) {
+ this.connectionReadyListener = connectionReadyListener;
+ }
+
+ @Override
+ public InetSocketAddress getRemoteAddress() {
+ return (InetSocketAddress) channel.remoteAddress();
+ }
}