Search in sources :

Example 6 with UnsupportedMessageTypeException

use of io.netty.handler.codec.UnsupportedMessageTypeException in project netty by netty.

the class SslHandler method write.

@Override
public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
    if (!(msg instanceof ByteBuf)) {
        UnsupportedMessageTypeException exception = new UnsupportedMessageTypeException(msg, ByteBuf.class);
        ReferenceCountUtil.safeRelease(msg);
        promise.setFailure(exception);
    } else if (pendingUnencryptedWrites == null) {
        ReferenceCountUtil.safeRelease(msg);
        promise.setFailure(newPendingWritesNullException());
    } else {
        pendingUnencryptedWrites.add((ByteBuf) msg, promise);
    }
}
Also used : CompositeByteBuf(io.netty.buffer.CompositeByteBuf) ByteBuf(io.netty.buffer.ByteBuf) UnsupportedMessageTypeException(io.netty.handler.codec.UnsupportedMessageTypeException)

Aggregations

UnsupportedMessageTypeException (io.netty.handler.codec.UnsupportedMessageTypeException)6 ByteBuf (io.netty.buffer.ByteBuf)2 HttpRequest (io.netty.handler.codec.http.HttpRequest)2 HttpResponse (io.netty.handler.codec.http.HttpResponse)2 CompositeByteBuf (io.netty.buffer.CompositeByteBuf)1 HttpContent (io.netty.handler.codec.http.HttpContent)1 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)1 LastHttpContent (io.netty.handler.codec.http.LastHttpContent)1 StreamException (io.netty.handler.codec.http2.Http2Exception.StreamException)1 PrimitiveEntry (io.netty.util.collection.IntObjectMap.PrimitiveEntry)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1