@Test
public void testCreateClientEndpoint() throws Exception {
MailEndpointComponent component = new MailEndpointComponent();
Endpoint endpoint = component.createEndpoint("smtp://localhost:22000", context);
Assert.assertEquals(endpoint.getClass(), MailClient.class);
Assert.assertEquals(((MailClient)endpoint).getEndpointConfiguration().getHost(), "localhost");
Assert.assertEquals(((MailClient) endpoint).getEndpointConfiguration().getPort(), 22000);
Assert.assertEquals(((MailClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L);
endpoint = component.createEndpoint("mail:localhost:25000", context);
Assert.assertEquals(endpoint.getClass(), MailClient.class);
Assert.assertEquals(((MailClient)endpoint).getEndpointConfiguration().getHost(), "localhost");
Assert.assertEquals(((MailClient) endpoint).getEndpointConfiguration().getPort(), 25000);
Assert.assertEquals(((MailClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L);
endpoint = component.createEndpoint("mail:localhost", context);
Assert.assertEquals(endpoint.getClass(), MailClient.class);
Assert.assertEquals(((MailClient)endpoint).getEndpointConfiguration().getHost(), "localhost");
Assert.assertEquals(((MailClient) endpoint).getEndpointConfiguration().getPort(), -1);
Assert.assertEquals(((MailClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L);
}