I want to write a unit test for some code that generates a SOAP message with an attachment and sends it: 

```
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
conn = factory.createConnection();
conn.call(message, endpoint);

```

where the factory is a `javax.xml.soap.SOAPConnectionFactory`

I don't care about any response coming back but I want to be able to verify the message that gets sent. The code is going to be refactored and I want to make sure it sends that same messages afterwards as before. 

Is there a framework i can use to create a mock endpoint that will let me analyse the request in my test? If so, some sample code would be very useful.