code: public static BlogConnection getBlogConnection(final String type, final String url, final String username, final String password)
              throws BlogClientException {
          BlogConnection blogConnection = null;
          if (type == null || type.equals("metaweblog")) {
              blogConnection = createBlogConnection(METAWEBLOG_IMPL_CLASS, url, username, password);
          } else if (type.equals("atom")) {
              blogConnection = createBlogConnection(ATOMPROTOCOL_IMPL_CLASS, url, username, password);
          } else {
              throw new BlogClientException("Type must be 'atom' or 'metaweblog'");
          }
          return blogConnection;
      }
docs: Create a connection to a blog server.
  
  @param type Connection type, must be "atom" or "metaweblog"
  @param url End-point URL to connect to
  @param username Username for login to blog server
  @param password Password for login to blog server