{
String username = "mule";
String password = "rulez";
String url = "test://" + username + ":" + password + "@localhost";
InboundEndpoint endpoint = getTestInboundEndpoint("Test", url);
ByteArrayToObject trans = new ByteArrayToObject();
trans.setMuleContext(muleContext);
MuleEvent event = RequestContext.setEvent(getTestEvent("payload", endpoint));
Serializable serialized = (Serializable) new SerializableToByteArray().transform(event);
assertNotNull(serialized);
MuleEvent deserialized = (MuleEvent) trans.transform(serialized);
assertNotNull(deserialized);
Credentials credentials = deserialized.getCredentials();
assertNotNull(credentials);
assertEquals(username, credentials.getUsername());