NetCrusher TCP and UDP proxy

NetCrusher is a managed TCP/UDP proxy that can be placed between a client and a server.

That allows to (A) control the connection and (B) get required information about the connection state and traffic statistics data. Both possibilities are very usefull for QA purpose.

NetCrusher suggest the following type of proxy engines:

Common methods

Both TcpCrusher and DatagramCrusher implement the same interfaces and have the same methods in common.

NetCrusher.open()

Method opens network proxy. After the crusher is open incoming connection is accepted and proxied.


crusher.open();

Crusher can be opened right on creation with `buildAndOpen()` method.


TcpCrusherBuilder.builder()
    // ...
    .buildAndOpen();

NetCrusher.close()

Closes the crusher proxy and all proxied connections.


crusher.close();

As crusher implements java.io.Closeable a shorter pattern can be used.


try (TcpCrusher crusher = builder.buildAndOpen()) {
}

NetCrusher.reopen()

Closes the crusher and opens again.

NetCrusher.isOpen()

Returns `true` if the crusher is in open state.

NetCrusher.getBindAddress()

Returns the address where the listening crusher socket is binded.

NetCrusher.getConnectAddress()

Returns the address where the crusher will connect to.

NetCrusher.getClientAddresses()

Returns the collection of crusher client addresses

NetCrusher.getClientByteMeters()

Retruns statistics on how many bytes passed through the crusher for the specified client.

NetCrusher.closeClient()

Closes the proxy channel for the specified client

NetFreezer.freeze()

Stops transferring the data. Sockets remain open but the data is not transferred between clients and target destination.

NetFreezer.unfreeze()

Restore transferring the data after freeze.

NetFreezer.isFrozen()

Returns `true` if the crusher is in the frozen state.