Remove deprecated call and TODO in Protocol negotiators

This commit is contained in:
Carl Mastrangelo 2016-02-04 13:13:15 -08:00
parent e61e6c27ad
commit 04a6c8395b
2 changed files with 6 additions and 19 deletions

View File

@ -32,7 +32,7 @@
package io.grpc.netty;
import io.grpc.Internal;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInboundHandler;
import io.netty.handler.codec.http2.Http2ConnectionHandler;
import io.netty.util.AsciiString;
@ -44,11 +44,8 @@ public interface ProtocolNegotiator {
/**
* The Netty handler to control the protocol negotiation.
*
* <p>TODO(carl-mastrangelo): Replace ChannelHandler with ChannelInboundHandler or
* ChannelOutboundHandler, since exceptionCaught is deprecated.
*/
interface Handler extends ChannelHandler {
interface Handler extends ChannelInboundHandler {
/**
* The HTTP/2 scheme to be used when sending {@code HEADERS}.
*/

View File

@ -89,30 +89,20 @@ public final class ProtocolNegotiators {
return new ProtocolNegotiator() {
@Override
public Handler newHandler(final Http2ConnectionHandler handler) {
return new Handler() {
class PlaintextHandler extends ChannelDuplexHandler implements Handler {
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
// Just replace this handler with the gRPC handler.
ctx.pipeline().replace(this, null, handler);
}
@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
// Don't care.
}
@Override
@Deprecated
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
// Should never happen.
ctx.fireExceptionCaught(cause);
}
@Override
public AsciiString scheme() {
return Utils.HTTP;
}
};
}
return new PlaintextHandler();
}
};
}