@Test public void sendErrorRequestAlreadyReleased() { RawRequest req = new RawRequest.Builder("service", "endpoint").build(); req.release(); assertNull(req.getArg1()); assertNull(req.getArg2()); assertNull(req.getArg3()); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.alloc()).thenReturn(ByteBufAllocator.DEFAULT); when(ctx.writeAndFlush(any())).thenReturn(mock(ChannelFuture.class)); ErrorFrame.sendError(ErrorType.BadRequest, "bad request", req, ctx); assertNull(req.getArg1()); assertNull(req.getArg2()); assertNull(req.getArg3()); }
public static ErrorFrame sendError(ErrorType type, String message, Request request, ChannelHandlerContext ctx) { try { ErrorFrame errorFrame = new ErrorFrame( request.getId(), type, new Trace(0, 0, 0, (byte) 0x00), message ); MessageCodec.write(ctx, errorFrame); return errorFrame; } finally { try { request.releaseQuietly(); } catch (RuntimeException ex) { } } }
ErrorFrame extends Frame { public static ErrorFrame sendError(ErrorType type, String message, Request request, ChannelHandlerContext ctx) { try { ErrorFrame errorFrame = new ErrorFrame( request.getId(), type, new Trace(0, 0, 0, (byte) 0x00), message ); MessageCodec.write(ctx, errorFrame); return errorFrame; } finally { try { request.releaseQuietly(); } catch (RuntimeException ex) { } } } }
ErrorFrame extends Frame { public static ErrorFrame sendError(ErrorType type, String message, Request request, ChannelHandlerContext ctx) { try { ErrorFrame errorFrame = new ErrorFrame( request.getId(), type, new Trace(0, 0, 0, (byte) 0x00), message ); MessageCodec.write(ctx, errorFrame); return errorFrame; } finally { try { request.releaseQuietly(); } catch (RuntimeException ex) { } } } ErrorFrame(long id, ErrorType errorType, Trace tracing, String message); protected  ErrorFrame(long id);  ErrorFrame(long id, ErrorType errorType, String message); }
ErrorFrame extends Frame { public static ErrorFrame sendError(ErrorType type, String message, Request request, ChannelHandlerContext ctx) { try { ErrorFrame errorFrame = new ErrorFrame( request.getId(), type, new Trace(0, 0, 0, (byte) 0x00), message ); MessageCodec.write(ctx, errorFrame); return errorFrame; } finally { try { request.releaseQuietly(); } catch (RuntimeException ex) { } } } ErrorFrame(long id, ErrorType errorType, Trace tracing, String message); protected  ErrorFrame(long id);  ErrorFrame(long id, ErrorType errorType, String message); @Override FrameType getType(); ErrorType getErrorType(); Trace getTracing(); String getMessage(); @Override String toString(); @Override ByteBuf encodeHeader(ByteBufAllocator allocator); @Override void decode(TFrame tFrame); static ErrorFrame sendError(ErrorType type,
                                       String message,
                                       Request request,
                                       ChannelHandlerContext ctx); static ErrorFrame sendError(ErrorType type, String message,
                                       long id,
                                       ChannelHandlerContext ctx); }
ErrorFrame extends Frame { public static ErrorFrame sendError(ErrorType type, String message, Request request, ChannelHandlerContext ctx) { try { ErrorFrame errorFrame = new ErrorFrame( request.getId(), type, new Trace(0, 0, 0, (byte) 0x00), message ); MessageCodec.write(ctx, errorFrame); return errorFrame; } finally { try { request.releaseQuietly(); } catch (RuntimeException ex) { } } } ErrorFrame(long id, ErrorType errorType, Trace tracing, String message); protected  ErrorFrame(long id);  ErrorFrame(long id, ErrorType errorType, String message); @Override FrameType getType(); ErrorType getErrorType(); Trace getTracing(); String getMessage(); @Override String toString(); @Override ByteBuf encodeHeader(ByteBufAllocator allocator); @Override void decode(TFrame tFrame); static ErrorFrame sendError(ErrorType type,
                                       String message,
                                       Request request,
                                       ChannelHandlerContext ctx); static ErrorFrame sendError(ErrorType type, String message,
                                       long id,
                                       ChannelHandlerContext ctx);  }