@Test public void configureConnectionTest() throws IOException { URL url = new URL(DUMMY_URL); HttpURLConnection connection = abstractRESTAdapter.configureConnection(url); assertThat(connection.getURL().toExternalForm(), equalTo(DUMMY_URL)); assertThat(connection.getRequestMethod(), equalTo(AbstractRESTAdapter.HTTP_REQUEST_METHOD)); assertThat(connection.getRequestProperty(AbstractRESTAdapter.HTTP_ACCEPT_TYPE_NAME), equalTo(de.datexis.encoder.impl.serde.DummyProvider.ACCEPT_TYPE)); assertThat(connection.getRequestProperty(AbstractRESTAdapter.HTTP_CONTENT_TYPE_NAME), equalTo(de.datexis.encoder.impl.serde.DummyProvider.CONTENT_TYPE)); assertThat(connection.getConnectTimeout(), equalTo(CONNECT_TIMEOUT)); assertThat(connection.getReadTimeout(), equalTo(READ_TIMEOUT)); assertThat(connection.getDoInput(), equalTo(true)); assertThat(connection.getDoOutput(), equalTo(true)); }
public HttpURLConnection configureConnection(URL url) throws IOException{ HttpURLConnection httpConnection = getConnection(url); httpConnection.setRequestMethod(HTTP_REQUEST_METHOD); httpConnection.setRequestProperty(HTTP_CONTENT_TYPE_NAME, getSerializationProvider().getContentType()); httpConnection.setRequestProperty(HTTP_ACCEPT_TYPE_NAME, getDeserializationProvider().getAcceptType()); httpConnection.setConnectTimeout(connectTimeout); httpConnection.setReadTimeout(readTimeout); httpConnection.setDoOutput(true); httpConnection.setDoInput(true); return httpConnection; }
AbstractRESTAdapter implements RESTAdapter { public HttpURLConnection configureConnection(URL url) throws IOException{ HttpURLConnection httpConnection = getConnection(url); httpConnection.setRequestMethod(HTTP_REQUEST_METHOD); httpConnection.setRequestProperty(HTTP_CONTENT_TYPE_NAME, getSerializationProvider().getContentType()); httpConnection.setRequestProperty(HTTP_ACCEPT_TYPE_NAME, getDeserializationProvider().getAcceptType()); httpConnection.setConnectTimeout(connectTimeout); httpConnection.setReadTimeout(readTimeout); httpConnection.setDoOutput(true); httpConnection.setDoInput(true); return httpConnection; } }
AbstractRESTAdapter implements RESTAdapter { public HttpURLConnection configureConnection(URL url) throws IOException{ HttpURLConnection httpConnection = getConnection(url); httpConnection.setRequestMethod(HTTP_REQUEST_METHOD); httpConnection.setRequestProperty(HTTP_CONTENT_TYPE_NAME, getSerializationProvider().getContentType()); httpConnection.setRequestProperty(HTTP_ACCEPT_TYPE_NAME, getDeserializationProvider().getAcceptType()); httpConnection.setConnectTimeout(connectTimeout); httpConnection.setReadTimeout(readTimeout); httpConnection.setDoOutput(true); httpConnection.setDoInput(true); return httpConnection; } protected  AbstractRESTAdapter();  AbstractRESTAdapter(long embeddingVectorSize, int connectTimeout, int readTimeout); }
AbstractRESTAdapter implements RESTAdapter { public HttpURLConnection configureConnection(URL url) throws IOException{ HttpURLConnection httpConnection = getConnection(url); httpConnection.setRequestMethod(HTTP_REQUEST_METHOD); httpConnection.setRequestProperty(HTTP_CONTENT_TYPE_NAME, getSerializationProvider().getContentType()); httpConnection.setRequestProperty(HTTP_ACCEPT_TYPE_NAME, getDeserializationProvider().getAcceptType()); httpConnection.setConnectTimeout(connectTimeout); httpConnection.setReadTimeout(readTimeout); httpConnection.setDoOutput(true); httpConnection.setDoInput(true); return httpConnection; } protected  AbstractRESTAdapter();  AbstractRESTAdapter(long embeddingVectorSize, int connectTimeout, int readTimeout); @Override long getEmbeddingVectorSize(); void setEmbeddingVectorSize(long embeddingVectorSize); int getConnectTimeout(); void setConnectTimeout(int connectTimeout); int getReadTimeout(); void setReadTimeout(int readTimeout); @Override double[] encode(String data); abstract double[] encodeImpl(String data); @Override double[][] encode(String[] data); abstract double[][] encodeImpl(String[] data); @Override double[][][] encode(String[][] data); abstract double[][][] encodeImpl(String[][] data); O request(I input, Class<O> classOfO, URL url); HttpURLConnection configureConnection(URL url); @JsonIgnore abstract SerializationProvider getSerializationProvider(); @JsonIgnore abstract DeserializationProvider getDeserializationProvider(); HttpURLConnection getConnection(URL url); }
AbstractRESTAdapter implements RESTAdapter { public HttpURLConnection configureConnection(URL url) throws IOException{ HttpURLConnection httpConnection = getConnection(url); httpConnection.setRequestMethod(HTTP_REQUEST_METHOD); httpConnection.setRequestProperty(HTTP_CONTENT_TYPE_NAME, getSerializationProvider().getContentType()); httpConnection.setRequestProperty(HTTP_ACCEPT_TYPE_NAME, getDeserializationProvider().getAcceptType()); httpConnection.setConnectTimeout(connectTimeout); httpConnection.setReadTimeout(readTimeout); httpConnection.setDoOutput(true); httpConnection.setDoInput(true); return httpConnection; } protected  AbstractRESTAdapter();  AbstractRESTAdapter(long embeddingVectorSize, int connectTimeout, int readTimeout); @Override long getEmbeddingVectorSize(); void setEmbeddingVectorSize(long embeddingVectorSize); int getConnectTimeout(); void setConnectTimeout(int connectTimeout); int getReadTimeout(); void setReadTimeout(int readTimeout); @Override double[] encode(String data); abstract double[] encodeImpl(String data); @Override double[][] encode(String[] data); abstract double[][] encodeImpl(String[] data); @Override double[][][] encode(String[][] data); abstract double[][][] encodeImpl(String[][] data); O request(I input, Class<O> classOfO, URL url); HttpURLConnection configureConnection(URL url); @JsonIgnore abstract SerializationProvider getSerializationProvider(); @JsonIgnore abstract DeserializationProvider getDeserializationProvider(); HttpURLConnection getConnection(URL url); static final String HTTP_REQUEST_METHOD; static final String HTTP_CONTENT_TYPE_NAME; static final String HTTP_ACCEPT_TYPE_NAME; }