@SuppressWarnings("unchecked")
public Attachment addAttachment(Attachment attachment) {
if (attachment instanceof BodyPartAttachment) {
try {
BodyPartAttachment att = (BodyPartAttachment) attachment;
AttachmentConfig newConfig = getConfig().addNewAttachment();
newConfig.setData(Tools.readAll(att.getInputStream(), 0).toByteArray());
newConfig.setContentId(att.getContentID());
newConfig.setContentType(att.getContentType());
newConfig.setName(att.getName());
FileAttachment<WsdlMockResponse> newAttachment = new MockFileAttachment(newConfig, this);
attachments.add(newAttachment);
return newAttachment;
} catch (Exception e) {