conn = new TestConnectionFactory(0, 1, uri).newConnection();
conn.close();
throw new RuntimeException("expected socket close");
} catch (IOException e) {}
ConnectionFactory factory;
factory = new ConnectionFactory();
factory.setUsername("invalid");
factory.setPassword("invalid");
try {
factory.setUri(uri);
conn = factory.newConnection();
conn.close();
throw new RuntimeException("expected socket close");
} catch (IOException e) {}
factory = new ConnectionFactory();
factory.setRequestedChannelMax(10);
factory.setRequestedFrameMax(8192);
factory.setRequestedHeartbeat(1);
factory.setUri(uri);
conn = factory.newConnection();
checkNegotiatedMaxValue("channel-max", 10, conn.getChannelMax());
checkNegotiatedMaxValue("frame-max", 8192, conn.getFrameMax());
checkNegotiatedMaxValue("heartbeat", 1, conn.getHeartbeat());
conn.close();
factory = new ConnectionFactory();
factory.setRequestedChannelMax(0);
factory.setRequestedFrameMax(0);
factory.setRequestedHeartbeat(0);
factory.setUri(uri);
conn = factory.newConnection();
checkNegotiatedMaxValue("channel-max", 0, conn.getChannelMax());
checkNegotiatedMaxValue("frame-max", 0, conn.getFrameMax());
checkNegotiatedMaxValue("heartbeat", 0, conn.getHeartbeat());
conn.close();
conn = new ConnectionFactory(){{setUri(uri);}}.newConnection();
conn.close();
}