public String sendXML( String xml, String service ) throws Exception {
    HttpPost method = buildSendXMLMethod( xml.getBytes( Const.XML_ENCODING ), service );
    try {
      return executeAuth( method );
    } finally {
      // Release current connection to the connection pool once you are done
      method.releaseConnection();
      if ( log.isDetailed() ) {
        log.logDetailed( BaseMessages.getString( PKG, "SlaveServer.DETAILED_SentXmlToService", service,
          environmentSubstitute( hostname ) ) );
      }
    }
  }
@Test( expected = NullPointerException.class )
  public void testSendXML() throws Exception {
    slaveServer.setHostname( "hostNameStub" );
    slaveServer.setUsername( "userNAmeStub" );
    HttpPost httpPostMock = mock( HttpPost.class );
    URI uriMock = new URI( "fake" );
    doReturn( uriMock ).when( httpPostMock ).getURI();
    doReturn( httpPostMock ).when( slaveServer ).buildSendXMLMethod( any( byte[].class ), anyString() );
    slaveServer.sendXML( "", "" );
    fail( "Incorrect connection details had been used, but no exception was thrown" );
  }