JdbcEndpointAdapterController implements JdbcController, EndpointAdapter { @Override public void openConnection(Map<String, String> properties) throws JdbcServerException { if (!endpointConfiguration.isAutoConnect()) { List<OpenConnection.Property> propertyList = convertToPropertyList(properties); handleMessageAndCheckResponse(JdbcMessage.openConnection(propertyList)); } if (connections.get() == endpointConfiguration.getServerConfiguration().getMaxConnections()) { throw new JdbcServerException(String.format("Maximum number of connections (%s) reached", endpointConfiguration.getServerConfiguration().getMaxConnections())); } connections.incrementAndGet(); } JdbcEndpointAdapterController(
            JdbcEndpointConfiguration endpointConfiguration,
            EndpointAdapter delegate);   JdbcEndpointAdapterController(
            JdbcEndpointConfiguration endpointConfiguration,
            EndpointAdapter delegate,
            DataSetCreator dataSetCreator); @Override Message handleMessage(Message request); @Override void openConnection(Map<String, String> properties); @Override void closeConnection(); @Override void createPreparedStatement(String stmt); @Override void createStatement(); @Override DataSet executeQuery(String query); @Override DataSet executeStatement(String stmt); @Override int executeUpdate(String updateSql); @Override void closeStatement(); @Override void setTransactionState(boolean transactionState); @Override boolean getTransactionState(); @Override void commitStatements(); @Override void rollbackStatements(); @Override void createCallableStatement(String sql); @Override Endpoint getEndpoint(); @Override EndpointConfiguration getEndpointConfiguration();  }
@Test public void testOpenConnection(){ final JdbcEndpointAdapterController jdbcEndpointAdapterController = spy(this.jdbcEndpointAdapterController); when(jdbcEndpointConfiguration.isAutoConnect()).thenReturn(true); jdbcEndpointAdapterController.getConnections().set(0); final int before = jdbcEndpointAdapterController.getConnections().get(); jdbcEndpointAdapterController.openConnection(new HashMap<>()); final int after = jdbcEndpointAdapterController.getConnections().get(); assertEquals(before + 1, after); verify(jdbcEndpointAdapterController, never()).handleMessage(any()); }