Class LoopbackResetRelay

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.mockserver.netty.proxy.relay.LoopbackResetRelay
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public final class LoopbackResetRelay extends io.netty.channel.ChannelInboundHandlerAdapter
Carries a deliberate reset (an HttpError resetConnection, or a chaos resetPeer or resetMidResponse) of a CONNECT/SOCKS tunnel's loopback through to the tunnel's client connection, which the relay would otherwise end with a clean close (or, on h2, a GOAWAY and stream resets). MockServer's end of the loopback marks the client connection, then ends the loopback's output rather than resetting it (ConnectionReset.reset(io.netty.channel.Channel)); this handler, first on the relay's end of the loopback, resets the client connection as the loopback closes (or a reset of it is read), before the relay's other handlers react to it, and after what the relay has already written to the client, so a response MockServer wrote first reaches the client first. A loopback reset nobody asked for is left to the relay's usual handling.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
     
    static void
    relayResetsOf(io.netty.channel.Channel accepted)
    On MockServer's end of a relay loopback: a reset of it also resets the tunnel's client connection.

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Method Details

    • relayResetsOf

      public static void relayResetsOf(io.netty.channel.Channel accepted)
      On MockServer's end of a relay loopback: a reset of it also resets the tunnel's client connection.
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter