2012-06-04 13:31:44 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2012 The Netty Project
|
|
|
|
*
|
|
|
|
* The Netty Project licenses this file to you under the Apache License,
|
|
|
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
2012-04-12 17:39:01 +09:00
|
|
|
package io.netty.channel;
|
|
|
|
|
|
|
|
import java.net.SocketAddress;
|
|
|
|
|
2012-06-07 16:56:21 +09:00
|
|
|
public class ChannelHandlerAdapter extends ChannelStateHandlerAdapter implements ChannelOperationHandler {
|
2012-04-12 17:39:01 +09:00
|
|
|
|
|
|
|
@Override
|
2012-06-07 14:52:33 +09:00
|
|
|
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelFuture future) throws Exception {
|
2012-05-01 17:19:41 +09:00
|
|
|
ctx.bind(localAddress, future);
|
2012-04-12 17:39:01 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2012-06-08 19:28:12 +09:00
|
|
|
public void connect(
|
|
|
|
ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress,
|
|
|
|
ChannelFuture future) throws Exception {
|
2012-05-01 17:19:41 +09:00
|
|
|
ctx.connect(remoteAddress, localAddress, future);
|
2012-04-12 17:39:01 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2012-06-07 14:52:33 +09:00
|
|
|
public void disconnect(ChannelHandlerContext ctx, ChannelFuture future) throws Exception {
|
2012-05-01 17:19:41 +09:00
|
|
|
ctx.disconnect(future);
|
2012-04-12 17:39:01 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2012-06-07 14:52:33 +09:00
|
|
|
public void close(ChannelHandlerContext ctx, ChannelFuture future) throws Exception {
|
2012-05-01 17:19:41 +09:00
|
|
|
ctx.close(future);
|
2012-04-12 17:39:01 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2012-06-07 14:52:33 +09:00
|
|
|
public void deregister(ChannelHandlerContext ctx, ChannelFuture future) throws Exception {
|
2012-05-01 17:19:41 +09:00
|
|
|
ctx.deregister(future);
|
2012-04-12 17:39:01 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2012-06-07 14:52:33 +09:00
|
|
|
public void flush(ChannelHandlerContext ctx, ChannelFuture future) throws Exception {
|
2012-06-10 10:48:11 +09:00
|
|
|
if (this instanceof ChannelOutboundHandler) {
|
|
|
|
throw new IllegalStateException(
|
|
|
|
"flush(...) must be overridden by " + getClass().getName() +
|
|
|
|
", which implements " + ChannelOutboundHandler.class.getSimpleName());
|
2012-06-07 16:56:21 +09:00
|
|
|
}
|
2012-06-07 17:25:15 +09:00
|
|
|
ctx.flush(future);
|
2012-04-12 17:39:01 +09:00
|
|
|
}
|
|
|
|
}
|