use of org.teiid.net.socket.SocketServerConnection in project teiid by teiid.
the class TestCommSockets method testConnectWithoutClientEncryption.
@Test
public void testConnectWithoutClientEncryption() throws Exception {
SSLConfiguration config = new SSLConfiguration();
config.setMode(SSLConfiguration.DISABLED);
SocketServerConnection conn = helpEstablishConnection(false, config, new Properties());
assertTrue(conn.selectServerInstance(false).getCryptor() instanceof NullCryptor);
conn.close();
}
use of org.teiid.net.socket.SocketServerConnection in project teiid by teiid.
the class TestCommSockets method testLobs.
@Test
public void testLobs() throws Exception {
SocketServerConnection conn = helpEstablishConnection(false);
FakeService fs = conn.getService(FakeService.class);
assertEquals(150, fs.lobMethod(new ByteArrayInputStream(new byte[100]), new StringReader(new String(new char[50]))));
assertEquals(2, storageManager.getCreated());
assertEquals(2, storageManager.getRemoved());
assertEquals(0, fs.lobMethod(new ByteArrayInputStream(new byte[0]), new StringReader(new String(new char[0]))));
assertEquals(4, storageManager.getCreated());
assertEquals(4, storageManager.getRemoved());
assertEquals((1 << 17) + 50, fs.lobMethod(new ByteArrayInputStream(new byte[1 << 17]), new StringReader(new String(new char[50]))));
assertEquals(6, storageManager.getCreated());
assertEquals(6, storageManager.getRemoved());
}
use of org.teiid.net.socket.SocketServerConnection in project teiid by teiid.
the class TestCommSockets method testServerRemoteStreaming.
@Test
public void testServerRemoteStreaming() throws Exception {
SocketServerConnection conn = helpEstablishConnection(false);
FakeService fs = conn.getService(FakeService.class);
assertEquals("hello world", ObjectConverterUtil.convertToString(fs.getReader()));
assertTrue(Serializable.class.isAssignableFrom(fs.getReader().getClass()));
}
use of org.teiid.net.socket.SocketServerConnection in project teiid by teiid.
the class TestCommSockets method helpTestNewInstance.
private void helpTestNewInstance(Properties p) throws CommunicationException, ConnectionException, SessionServiceException {
SSLConfiguration config = new SSLConfiguration();
SocketServerConnection conn = helpEstablishConnection(false, config, p);
SocketListenerStats stats = listener.getStats();
// handshake response, logon,
assertEquals(2, stats.objectsRead);
assertEquals(1, stats.sockets);
conn.cleanUp();
assertEquals(1, this.service.getActiveSessionsCount());
ServerConnection conn2 = helpEstablishConnection(false, config, p);
assertEquals(2, this.service.getActiveSessionsCount());
conn.selectServerInstance(false);
assertEquals(2, this.service.getActiveSessionsCount());
assertTrue(conn.isOpen(10000));
stats = listener.getStats();
// (ping (pool test), assert identityx2, ping (isOpen))x2
assertEquals(8, stats.objectsRead);
assertEquals(2, stats.sockets);
conn.close();
conn2.close();
}
use of org.teiid.net.socket.SocketServerConnection in project teiid by teiid.
the class TestFailover method testFailover.
@Test
public void testFailover() throws Exception {
SSLConfiguration config = new SSLConfiguration();
Properties p = new Properties();
SocketServerConnection conn = helpEstablishConnection(false, config, p);
assertTrue(conn.isOpen(1000));
assertEquals(1, logonAttempts);
// restart the second instance now that we know the connection was made to the first
listener1 = createListener(new InetSocketAddress(addr.getAddress(), listener1.getPort()), config);
listener.stop().await();
// there is a chance this call can fail
conn.isOpen(1000);
assertTrue(conn.isOpen(1000));
assertEquals(2, logonAttempts);
listener1.stop().await();
// both instances are down
assertFalse(conn.isOpen(1000));
// bring the first back up
listener = createListener(new InetSocketAddress(addr.getAddress(), listener.getPort()), config);
assertTrue(conn.isOpen(1000));
assertEquals(3, logonAttempts);
conn.close();
}
Aggregations