package com.coderising.download.impl; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import com.coderising.download.api.Connection; import com.coderising.download.api.ConnectionException; import com.coderising.download.api.ConnectionManager; public class ConnectionManagerImpl implements ConnectionManager { @Override public Connection open(String url) throws ConnectionException { Connection connection = null; try { URL urlObject = new URL(url); HttpURLConnection openConnection = (HttpURLConnection)urlObject.openConnection(); connection = new ConnectionImpl(openConnection); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return connection; } }