private static void CloseReason0(params IChannelHandler[] handlers) { EmbeddedChannel ch = new EmbeddedChannel( new HttpObjectAggregator(42)); ch.Pipeline.AddLast(handlers); Upgrade0(ch, new WebSocketServerHandshaker13("ws://example.com/chat", "chat", WebSocketDecoderConfig.NewBuilder().MaxFramePayloadLength(4).CloseOnProtocolViolation(true).Build())); ch.WriteOutbound(new BinaryWebSocketFrame(Unpooled.WrappedBuffer(new byte[8]))); var buffer = ch.ReadOutbound <IByteBuffer>(); try { ch.WriteInbound(buffer); Assert.False(true); } catch (CorruptedWebSocketFrameException) { // expected } IReferenceCounted closeMessage = ch.ReadOutbound <IReferenceCounted>(); Assert.True(closeMessage is IByteBuffer); closeMessage.Release(); Assert.False(ch.Finish()); }
public static void SafeRelease(this IReferenceCounted msg, int decrement) { try { msg?.Release(decrement); } catch (Exception ex) { Logger.Warn("Failed to release a message: {} (decrement: {})", msg, decrement, ex); } }
public static void SafeRelease(this IReferenceCounted msg) { try { msg?.Release(); } catch (Exception ex) { Logger.Warn("Failed to release a message: {}", msg, ex); } }
public static void SafeRelease(this IReferenceCounted msg, int decrement) { try { _ = msg?.Release(decrement); } catch (Exception ex) { Logger.FailedToReleaseAMessage(msg, decrement, ex); } }
public static void SafeRelease(this IReferenceCounted msg) { try { _ = (msg?.Release()); } catch (Exception ex) { Logger.FailedToReleaseAMessage(msg, ex); } }
public static void SafeRelease(this IReferenceCounted msg, int decrement) { try { msg?.Release(decrement); } catch (Exception ex) { Debug.Log("Failed to release a message: " + msg + " decrement=" + decrement + " -> " + ex); } }
public static void SafeRelease(this IReferenceCounted msg) { try { msg?.Release(); } catch (Exception ex) { if (Logger.IsWarnEnabled) { Logger.Warn(msg, ex); } } }
protected override bool Release0() => _referenceCountDelegate.Release();