Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ This is an extension module to enable Man-In-The-Middle impersonation for HTTPS.
<github.global.server>github</github.global.server>
<skipTests>false</skipTests>
<!-- Versions should better be retrieved from a parent module. -->
<netty.version>4.0.36.Final</netty.version>
<slf4j.version>1.7.21</slf4j.version>
<bouncycastle.version>1.51</bouncycastle.version>
<littleproxy.version>1.1.0</littleproxy.version>
<netty.version>4.0.54.Final</netty.version>
<slf4j.version>1.7.25</slf4j.version>
<bouncycastle.version>1.59</bouncycastle.version>
<littleproxy.version>1.1.2</littleproxy.version>
<junit.version>4.12</junit.version>
<hamcrest.version>1.0.0.1</hamcrest.version>
<hamcrest.version>2.0.0.0</hamcrest.version>
<maven-jar-plugin.version>2.6</maven-jar-plugin.version>
</properties>

Expand Down Expand Up @@ -110,6 +110,11 @@ This is an extension module to enable Man-In-The-Middle impersonation for HTTPS.
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>

</dependencies>

Expand Down Expand Up @@ -332,9 +337,9 @@ This is an extension module to enable Man-In-The-Middle impersonation for HTTPS.
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jxr-maven-plugin</artifactId>
<version>2.3</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</reporting>
Expand Down
19 changes: 9 additions & 10 deletions src/test/java/de/ganskef/test/NettyClient_NoHttps.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,20 @@ protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg)
throws Exception {
if (msg instanceof HttpContent) {
HttpContent content = (HttpContent) msg;
RandomAccessFile output = null;
FileChannel oc = null;
try {
output = new RandomAccessFile(file, "rw");
oc = output.getChannel();
try (
RandomAccessFile output = new RandomAccessFile(file, "rw");
FileChannel oc = output.getChannel()
)
{
oc.position(oc.size());
ByteBuf buffer = content.content();
for (int i = 0, len = buffer.nioBufferCount(); i < len; i++) {
for (int i = 0, len = buffer.nioBufferCount(); i < len; i++)
{
oc.write(buffer.nioBuffers()[i]);
}
} finally {
IOUtils.closeQuietly(oc);
IOUtils.closeQuietly(output);
}
if (content instanceof LastHttpContent) {
if (content instanceof LastHttpContent)
{
ctx.close();
}
}
Expand Down