Nick,

This is how TCPMon works (for the moment):

The core of TCPMon is the Interceptor class. It is responsible for
connection handling and for rewriting requests and responses (e.g. for
substituting the Host header when acting in man-in-the-middle mode).
You can pass an InterceptorListener implementation to the Interceptor.
For each request-response exchange, Interceptor will create a new
RequestResponseListener via
InterceptorListener#createRequestResponseListener. This instance will
receive a transcript of the request and response. All this part of the
code is completely independent of the UI.

The UI implements the InterceptorListener and RequestResponseListener
interfaces. In particular, (most of) the code implementing
RequestResponseListener is in AbstractRequestResponse. The interesting
stuff is happening in the getRequestOutputStream and
getResponseOutputStream methods. Each of them constructs a pipeline
with a set of filters, the last one of which decodes the byte stream
and sends it to a java.io.Writer. For the Swing UI this will be a
JTextAreaWriter.

This gives you several options:

- If you don't need the UI, just implement InterceptorListener and
RequestResponseListener and reuse the core of TCPMon, i.e.
Interceptor.
- If you need the UI, you can still to that, but since Interceptor can
have at most one InterceptorListener, you need to implement something
like a TeeInterceptorListener to dispatch to two listeners.
- Alternatively you can plug your code into getRequestOutputStream and
getResponseOutputStream in AbstractRequestResponse (maybe using a Tee
filter).

Note that I wrote "for the moment" above because the code is
undergoing some heavy refactoring which is not yet finished.

Regards,

Andreas

On Wed, Jun 17, 2009 at 22:31, Neuberger, Nicholas
(EHQ)<npneuber...@express-scripts.com> wrote:
>
> Is there a specific location in the codebase for TcpMon where I can
> intercept the request and responses in debug mode?   So far, I've found
> the class JTextAreaWriter.java    I don't believe this is the right
> class for a breakpoint, but that's where I'm started.   I'm working with
> what is in SVN / Trunk.
>
>
> The feature what I'm tasked with doing is building out a recorder /
> playback feature that could be possibly be integrated with TcpMon.   I
> want to store all of the request / responses into a persistence layer
> for later playback during future project work.   The intention is to
> have a persistence store of various test scenarios.
>
> If you need further implementation details let me know.
>
> Thanks,
>
> Nick
>
>

Reply via email to