Skip to content

Feature request: ability to reject a connection to simulate ECONNREFUSED #72

@viglucci

Description

@viglucci

First off -- thank you for the great package! I've already found it very useful after just a short usage period.

For my use case, I am looking to be able to simulate a connection failure, such as ECONNREFUSED. I don't believe this functionality currently exists.

What I would recommend is a reject() method be added to socket, which is passed to the connect even callback.

mitm.on("connect", function (socket) {
  socket.reject();
});

I'll submit a PR soon adding this functionality for your review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions