@Test
  public void testTwoParamConstructor() {
    try {
      new AciServerDetails(null, 10);
      fail("Should have thrown an IllegalArgumentException as host is null.");
    } catch (final IllegalArgumentException iae) {
      /* ignore */
    }

    try {
      new AciServerDetails("localhost", -10);
      fail("Should have thrown an IllegalArgumentException as the port is out of range.");
    } catch (final IllegalArgumentException iae) {
      /* ignore */
    }

    try {
      new AciServerDetails("localhost", 123456789);
      fail("Should have thrown an IllegalArgumentException as the port is out of range.");
    } catch (final IllegalArgumentException iae) {
      /* ignore */
    }

    // Create one for real...
    final AciServerDetails details = new AciServerDetails("localhost", 10);

    // Check everything is null...
    assertThat(details.getProtocol(), is(equalTo(AciServerDetails.TransportProtocol.HTTP)));
    assertThat(details.getHost(), is(equalTo("localhost")));
    assertThat(details.getPort(), is(10));
    assertThat(details.getCharsetName(), is("UTF-8"));
    assertThat(details.getEncryptionCodec(), is(nullValue()));
  }
  @Test
  public void testEncryptionCodecProperty() {
    // Create an instance...
    final AciServerDetails details = new AciServerDetails();
    assertThat(
        "encryptionCodec property is not null", details.getEncryptionCodec(), is(nullValue()));

    // Set the encryptionCodec to something...
    final EncryptionCodec encryptionCodec = new TestEncryptionCodec();
    details.setEncryptionCodec(encryptionCodec);
    assertThat(
        "encryptionCodec property is not as expected",
        details.getEncryptionCodec(),
        is(sameInstance(encryptionCodec)));

    // Set the encryptionCodec to null and check....
    details.setEncryptionCodec(null);
    assertThat(
        "encryptionCodec property is not null", details.getEncryptionCodec(), is(nullValue()));
  }
  @Test
  public void testCopyConstructor() {
    // The codec to use...
    final TestEncryptionCodec encryptionCodec = new TestEncryptionCodec();

    // Create an instance...
    final AciServerDetails details = new AciServerDetails();
    details.setHost("localhost");
    details.setPort(12345);
    details.setEncryptionCodec(encryptionCodec);

    // Copy...
    final AciServerDetails newDetails = new AciServerDetails(details);

    // Check everything was coppied across...
    assertThat("protocol", newDetails.getProtocol(), is(equalTo(details.getProtocol())));
    assertThat("host", newDetails.getHost(), is(equalTo(details.getHost())));
    assertThat("port", newDetails.getPort(), is(equalTo(details.getPort())));
    assertThat("charsetName", newDetails.getCharsetName(), is(equalTo(details.getCharsetName())));
    assertThat(
        "encryptionCodec",
        newDetails.getEncryptionCodec(),
        is(sameInstance(details.getEncryptionCodec())));
  }
  @Test
  public void testDefaultConstructor() {
    // Create an instance...
    final AciServerDetails details = new AciServerDetails();

    // Check everything is null...
    assertThat(
        "protocol property is not HTTP",
        details.getProtocol(),
        is(equalTo(AciServerDetails.TransportProtocol.HTTP)));
    assertThat("host property is not null", details.getHost(), is(nullValue()));
    assertThat("port property is not 0", details.getPort(), is(0));
    assertThat("charsetName property is incorrect", details.getCharsetName(), is("UTF-8"));
    assertThat(
        "encryptionCodec property is not null", details.getEncryptionCodec(), is(nullValue()));
  }